Mysql5.7.19安装步骤
1、下载 下载地址:http://mirror.switch.ch/mirror/mysql/Downloads 2、安装 #tar zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz -C /usr/local #Cd /usr/local #Mv mysql-5.7.19-linux-glibc2.12-x86_64 mysql #groupadd mysql
useradd -r -g mysql -s /bin/false mysql
#cd /usr/local/mysql #mkdir mysql-files data #chown -R mysql.mysql . 创建/etc/my.cnf文件,内容如下: [mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data socket=/tmp/mysql.sock user=mysql character-set-server=utf8
Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe] log-error=/var/log/mysqld.log pid-file=/tmp/mysqld.pid
#########################################################################
#bin/mysql_install_db --user=mysql #mysql5.7.5用此方式初始化 #bin/mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql #mysql5.7.6及以上用此方式初始化,注意最后的临时密码
cp support-files/mysql.server /etc/init.d/mysqld
#ln -s /usr/local/mysql/bin/* /usr/local/bin/ 3、启动mysql
bin/mysqld_safe --user=mysql &
4、修改密码 #mysql -uroot -p #回车,输入初始密码 mysql>set password=password('Zhxg@2018!'); mysql> flush privileges;