Install MySql on CentOS 7

1. Install MySql

[root@centos]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
[root@centos]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
[root@centos]# yum install mysql-server

2. Start MySql

[root@centos]# systemctl start mysqld

3. Log in to MySql

[root@centos]# mysql -u root -p

Note: The default installed MySql password is empty, just press Enter to log in

Fourth, modify the MySql login password

[root@centos]# mysql -u root -p
Enter password:

mysql> use mysql
mysql> update user set password=password('test') where user = 'root';
mysql> flush privileges;

Five, configure MySql to allow remote access

[root@centos]# mysql -u root -p
Enter password:

mysql> grant all privileges on *.* to root@'%' identified by 'test';
mysql> flush privileges;

 

 

 

Guess you like

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