centos6.5安装mysql-5.7

1.下载

先到mysql的官方下载64为的二进制包官方下载

搜狐镜像

2.解压

tar xf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

3.移动

mv mysql-5.7.17 /usr/local/mysql

4.标记版本

touch /usr/local/mysql/mysql-5.7.17

5.初始化

./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql
2017-01-07 20:58:11 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2017-01-07 20:58:17 [WARNING] The bootstrap log isn't empty:
2017-01-07 20:58:17 [WARNING] 2017-01-08T01:58:11.970260Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead
2017-01-08T01:58:11.971001Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-01-08T01:58:11.971010Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

6.mysql_install_db is deprecated

提示说,不赞成使用mysql_install_db,请使用mysqld --initialize,清空datadir目录,再来mysqld --initialize

7.mysqld --initialize

./mysqld --initialize --initialize-insecure --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql
./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

8.error while loading shared libraries: libaio.so.1

yum install libaio -y
./mysqld --initialize --initialize-insecure --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql

9.initialize-insecure

加上这个选项的话,初始化后的mysql是空密码,这样你就不用满大街的找密码了,数据库启动后,记得走一遍mysql_secure_installation,给root加上密码。

步骤整理:

wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
tar xf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.7.17 /usr/local/mysql
touch /usr/local/mysql/mysql-5.7.17
yum install libaio -y
./mysqld --initialize --initialize-insecure --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql
/usr/local/mysql/bin/mysql_secure_installation

原创文章,转载请注明: 转载自笛声

本文链接地址: centos6.5安装mysql-5.7

暂无评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注