[root@localhost xiongjiajia]# vim /etc/my.cnf
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
sql_mode=NO_ENGINE_SUBSTITUTION
[root@localhost xiongjiajia]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
[root@localhost xiongjiajia]# mysqladmin -u root password 123456
[root@localhost xiongjiajia]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.6.31 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> insert into mysql.user(Host,User,Password) values("%","xiongjiajia",password("123456"));
Query OK, 1 row affected, 3 warnings (0.00 sec)
mysql> select host,user,password from mysql.user;
+-----------------------+-------------+-------------------------------------------+
| host | user | password |
+-----------------------+-------------+-------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| localhost.localdomain | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| localhost.localdomain | | |
| % | xiongjiajia | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+-----------------------+-------------+-------------------------------------------+
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on *.* to xiongjiajia@"%" identified by "123456" ;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@localhost xiongjiajia]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@localhost xiongjiajia]# firewall-cmd --reload
success