CentOS 7安装MySql

一、安装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

二、启动MySql

[root@centos]# systemctl start mysqld

三、登陆MySql

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

注:默认安装的MySql密码为空,直接回车即可登陆

四、修改MySql登陆密码

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

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

五、配置MySql允许远程访问

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

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

猜你喜欢

转载自my.oschina.net/kolbe/blog/1627500