centos 6.6编译安装mysql 5.6
时间:2015-07-11 19:29 来源:linux.it.net.cn 作者:IT
1.下载源码
wget http:
//dev
.mysql.com
/get/Downloads/MySQL-5
.6
/mysql-5
.6.25.
tar
.gztar xzvf mysql-5.6.25.
tar
.gz
2.安装前准备
#添加用户组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了,设置源码编译配置脚本。
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文件
rm
CMakeCache.txt
#编译make#安装make install
4.mysql主目录和数据目录处理
chown
-R mysql:www
/usr/local/mysqlchown
-R mysql:www
/data/soft/mysql
5.初始化数据库
chmod
+x
/usr/local/mysql/scripts/mysql_install_db/usr/local/mysql/scripts/mysql_install_db
--user=mysql --datadir=
/data/soft/mysql
6.复制配置文件
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.复制服务脚本
cp
/usr/local/mysql/support-files/mysql
.server
/etc/init
.d
/mysqldchmod
+x
/etc/init
.d
/mysqld
8.添加开机启动项
/etc/init
.d
/mysqld
startchkconfig --level 35 mysqld on
9.运行安全设置脚本,修改MySQL用户root的密码,同时可禁止root远程连接,移除
test
数据库和匿名用户。
/usr/local/mysql/scripts/mysql_install_db
--basedir=
/usr/local/mysql
--datadir=
/data
(责任编辑:IT)
1.下载源码 wget http: //dev .mysql.com /get/Downloads/MySQL-5 .6 /mysql-5 .6.25. tar .gztar xzvf mysql-5.6.25. tar .gz 2.安装前准备 #添加用户组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了,设置源码编译配置脚本。 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文件 rm CMakeCache.txt #编译make#安装make install 4.mysql主目录和数据目录处理 chown -R mysql:www /usr/local/mysqlchown -R mysql:www /data/soft/mysql 5.初始化数据库 chmod +x /usr/local/mysql/scripts/mysql_install_db/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir= /data/soft/mysql 6.复制配置文件 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.复制服务脚本 cp /usr/local/mysql/support-files/mysql .server /etc/init .d /mysqldchmod +x /etc/init .d /mysqld 8.添加开机启动项 /etc/init .d /mysqld startchkconfig --level 35 mysqld on 9.运行安全设置脚本,修改MySQL用户root的密码,同时可禁止root远程连接,移除 test 数据库和匿名用户。 /usr/local/mysql/scripts/mysql_install_db --basedir= /usr/local/mysql --datadir= /data (责任编辑:IT) |