Install mysql5.7.13 under linux

 
1. Check if mysql is already installed
rpm -qa | grep mysql
2. Delete mysql and keep dependent packages
rpm -e mysql-xxxxx --nodeps
3. Create user groups and users
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
4. Change the user and user group to which the user belongs
chown -R mysql .
chgrp -R mysql .
5. Install and initialize the database
bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
6. Copy configuration files and service startup files
cp -a ./support-files/my-default.cnf /etc/my.cnf
cp -a ./support-files/mysql.server /etc/init.d/mysqld
7. Restart the msql service
cd bin /
./mysqld_safe --user=mysql &
/etc/init.d/mysqld restart
8. Log in to the mysql service
cat /root/.mysql_secret
./mysql -uroot -p
9. Change the password
SET PASSWORD = PASSWORD('root');
flush privileges;
10. Add remote access permissions
use mysql; 
update user set host = '%' where user = 'root';
11. Restart to take effect
/etc/init.d/mysqld restart

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326386939&siteId=291194637