CentOS 7 上编译安装MySQL 5.6.23
2016-06-06 20:53
411 查看
1.下载源码
2.解压
3.安装必要的包
4.进入mysql源码目录,生成makefile
5.编译
6.安装
mysql将会安装到/usr/local/mysql路径,所以安装前文件不要存放在这个目录里
7.添加MySQL用户和组
8.修改目录和文件权限,安装默认数据库
不要忘记命令最后的圆点
至此,mysql就可以启动运行了。
9.启动mysql
然后再/etc下重建my.cnf文件,内容如下
现在可以启动mysql了
CentOS7 不能使用service控制mysql服务,而源码安装的mysql也没有提供Systemd的控制脚本。
于是编辑/etc/rc.d/rc.local文件,添加mysql的开机启动命令。
然后给/etc/rc.d/rc.local添加可执行权限
9.修改root密码
至此,安装基本完成了,一个mysql就能用了。
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.23.tar.gz
2.解压
tar zxvf mysql-5.6.23.tar.gz
3.安装必要的包
sudo yum install cmake gcc-c++ ncurses-devel perl-Data-Dumper
4.进入mysql源码目录,生成makefile
cmake .
5.编译
make
6.安装
make install
mysql将会安装到/usr/local/mysql路径,所以安装前文件不要存放在这个目录里
7.添加MySQL用户和组
sudo groupadd mysql sudo useradd -r -g mysql mysql
8.修改目录和文件权限,安装默认数据库
cd /usr/local/mysql chown -R mysql . chgrp -R mysql . scripts/mysql_install_db --user=mysql chown -R root . chown -R mysql data
不要忘记命令最后的圆点
至此,mysql就可以启动运行了。
9.启动mysql
cd /etc rm -fr my.cnf my.cnf.d
然后再/etc下重建my.cnf文件,内容如下
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. # basedir = ..... # datadir = /data/mysql/data # port = ..... # server_id = ..... # socket = ..... # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M max_connection = 10000 sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES #binary log log-bin = mysql-bin binlog_format = mixed expire_logs_day = 30 #slow query log slow_query_log = 1 slow_query_log_file = /var/log/mysql/slow.log long_query_time = 3 log-queries-not-using-indexes log-slow-admin-statements
现在可以启动mysql了
/usr/local/mysql/bin/mysqld_safe --user=mysql &
CentOS7 不能使用service控制mysql服务,而源码安装的mysql也没有提供Systemd的控制脚本。
于是编辑/etc/rc.d/rc.local文件,添加mysql的开机启动命令。
/usr/local/mysql/bin/mysqld_safe --user=mysql &
然后给/etc/rc.d/rc.local添加可执行权限
chmod a+x /etc/rc.d/rc.local
9.修改root密码
/usr/loca/mysql/bin/mysql -uroot use mysql; UPDATE user SET password = PASSWORD('test2015') WHERE user = 'root'; GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'passwd2015'; FLUSH PRIVILEGES;
至此,安装基本完成了,一个mysql就能用了。
相关文章推荐
- linux课堂笔记2
- Linux内存管理之一 分段与分页
- 开源新闻速递:Linux 4.7 内核发布了第二个 RC 版本
- linux下搭建FTP服务器
- centos中添加sudo用户和日志
- ARM-Linux S5PV210 UART驱动(转)
- Linux内核移植
- Linux下Clion编译Cmake报错的解决方案
- CentOS 7 升级Python到3.5后,yum,和gnome-twear-tool 出现的问题
- Linux下I2C接口触摸屏驱动分析
- linux 下文件夹的复制、覆盖以及确认问题解决
- 64位linux下eclipseADT不生成R.java文件的终极解决方案
- Linux 系统目录结构
- 在linux下使用curl访问 多参数url GET参数问题
- Linux启用ssh服务
- linux c 实现一个进度条
- Linux内存管理之mmap详解
- LINUX内核调度器+linux 内存
- 在 Linux 客户端配置基于 Kerberos 身份验证的 NFS 服务器
- 【kaldi】Kaldi+CUDA安装向问题(含libtool is not installed.的解决方法)