centos7下编译安装mysql
2016-09-22 17:26
459 查看
下载
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.23.tar.gz
解压
tar zxvf mysql-5.6.23.tar.gz
安装编译环境
sudo yum install cmake gcc-c++ ncurses-devel perl-Data-Dumper
编译安装
进入mysql源码目录,生成makefilecmake . make make install
mysql将会安装到/usr/local/mysql路径。
修改目录和文件权限,初始化数据库
cd /usr/local/mysql sudo chown -R mysql . sudo chgrp -R mysql . sudo scripts/mysql_install_db --user=mysql
修改my.cnf文件
/etc下默认存在my.cnf文件干扰mysql运行,需要先删掉,然后再/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加入到系统服务中:
cp support-files/mysql.server /etc/init.d/mysql chkconfig mysql on service mysql start
附:可能出现下面问题:
Starting MySQL................ ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).
说明需要给/usr/local/mysql/data目录读写权限这里直接用:
sudo chmod 777 /usr/local/mysql/data
还需要重启机器:
reboot
还有将mysql命令加入环境变量:
export PATH=/usr/local/mysql/bin:$PATH
安装5.6版本的初始化工具
执行命令行(前提是mysql已经启动):mysql_secure_installation
按照提示初始化即可
以上
参考:http://blog.csdn.net/skykingf/article/details/44776057相关文章推荐
- 在CentOS 7下编译安装Nginx+PHP+MySQL环境
- 在CentOS 7下编译安装Nginx+PHP+MySQL环境
- Centos7下编译安装配置Nginx+PHP+MySql环境
- CentOS 7下编译安装MySQL
- CentOS 编译 nginx+php+mysql 安装手记
- 64位centos上nginx,php编译安装遇configure: error: Cannot find libmysqlclient under /usr 错误解决
- CentOS5.6下使用cmake编译MySQL5.5.13源码和安装笔录
- CentOS 6 下编译安装 mySQL5
- CentOS 5.5 编译安装apache+php+mysql,利用CMS快速建立论坛
- CentOS 5.4 x86_64 编译安装 MySQL 完全笔记
- CentOS下编译安装mysql 5.5.10
- CentOS 编译 nginx+php+mysql 安装手记
- CentOS5.6下使用cmake编译MySQL5.5.13源码和安装笔录 推荐
- CentOS下编译安装Nginx+PHP+MySQL
- CentOS MySQL安装和编译【转帖】
- CentOS5.6下使用cmake编译MySQL5.5.13源码和安装笔录
- centos 编译安装php,apache,mysql
- Linux(centos) 编译安装 Mysql 后配置开机自动启动
- CentOS 下源码编译安装apache+php+mysql
- CentOS 5.4编译安装MySQL