[root@Mysql-server ~]# service mysql start
Starting MySQL SUCCESS!
18,登录mysql
[root@Mysql-server ~]# mysql -u root -p
Enter password:
19,修改密码
mysql> alter user 'root'@'localhost' identified by 'sin-8023';
Query OK, 0 rows affected (0.02 sec)
20,开启远程访问
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>select host, user, authentication_string, plugin from user;#查看用户信息4 rows inset(0.00 sec)
mysql> CREATE USER'root'@'%' IDENTIFIED BY 'root';#创建任意ip链接root用户
Query OK, 0 rows affected (3.51 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;#授权root用户可以远程登录
Query OK, 0 rows affected (0.24 sec)
mysql> flush privileges;#立即生效
Query OK, 0 rows affected (0.34 sec)
21,重启服务器
[root@Mysql-server ~]# service mysql restart
Shutting down MySQL..... SUCCESS!
Starting MySQL.......... SUCCESS!