1.下载源码 12 wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.25.tar.gztar xzvf mysql-5.6.25.tar.gz 2.安装前准备 123456789 #添加用户组groupadd www#添加用户useradd -c mysql-user -g www -M mysql#安装依赖yum install libaio-devel#创建数据目录mkdir /data/soft/mysqlchown -R mysql:www /data/soft/mysql 3.安装从mysql5.5起,mysql源码安装开始使用cmake了,设置源码编译配置脚本。 1 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1 注:重新运行配置,需要删除CMakeCache.txt文件 1 rm CMakeCache.txt 1234 #编译make#安装make install 4.mysql主目录和数据目录处理 12 chown -R mysql:www /usr/local/mysqlchown -R mysql:www /data/soft/mysql 5.初始化数据库 12 chmod +x /usr/local/mysql/scripts/mysql_install_db/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/soft/mysql 6.复制配置文件 123456789 cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf修改一些配置# These are commonly set, remove the # and set as required.basedir = /usr/local/mysql# datadir = .....datadir = /data/soft/mysql# port = .....# server_id = .....socket = /usr/local/mysql/mysql.sock 7.复制服务脚本 12 cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqld 8.添加开机启动项 12 /etc/init.d/mysqld startchkconfig --level 35 mysqld on 9.运行安全设置脚本,修改MySQL用户root的密码,同时可禁止root远程连接,移除test数据库和匿名用户。 1 /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/soft/mysql --user=mysql
本文出自 “James” 博客,转载请与作者联系!
原文地址:http://15899573484.blog.51cto.com/1918757/1672930