Centos6.3安装mysql-5.7.12二进制文件

1、下载软件

wget http://120.52.72.59/cdn.mysql.com/c3pr90ntcsf0//Downloads/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar

tar xvf mysql-test-5.7.12-linux-glibc2.5-x86_64.tar.gz

tar xvzf mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz

mv mysql-5.7.12-linux-glibc2.5-x86_64 /usr/local/mysql

ln -s /usr/local/mysql/bin/mysql /usr/bin

cp support-files/mysql.server /etc/init.d/

2、添加mysql用户

groupadd mysql

useradd -r -g mysql mysql

mkdir /data/mysql

chown -R mysql:mysql /usr/local/mysql

chown -R mysql:mysql /data/mysql



3、修改my.cnf

vim /etc/my.cnf

[mysqld]

basedir = /usr/local/mysql

datadir = /data/mysql

port = 3306

socket = /data/mysql/mysql.sock


[client]

default-character-set=utf8

socket = /data/mysql/mysql.sock




4、启动:

bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

/etc/init.d/mysqld start


注意:

(1)之前版本mysql_install_db是在mysql_basedir/script下,5.7放在了mysql_install_db/bin目录下,且已被废弃。

bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

或者

bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

“--initialize””--initialize-insecure”区别在于“--initialize”生成一个随机密码”--initialize-insecure”会生成密码。

(2)

没有生成 .mysql_secret 文件,

修改密码:

bin/mysqladmin -h localhost -u root password '123456' -p'*'

参考:

http://www.oschina.net/news/60401/mysql-5-7-6?utm_source=tuicool


你可能感兴趣的:(mysql)