1. mySql-Server only allows access from the Local Machine (localhost, 127.0.0.1) for security reasons. this is no problem for the website architecture of both Web-Server and MySql-Server on the same Server. however, as website traffic increases, the Server architecture may separate Web-Server and MySql-Server
1. mySql-Server only allows access from the Local Machine (localhost, 127.0.0.1) for security reasons. this is no problem for the website architecture of both Web-Server and MySql-Server on the same Server. however, as website traffic increases, the Server architecture may separate Web-Server and MySql-Server
1. mySql-Server only allows access from the Local Machine (localhost, 127.0.0.1) for security reasons. this is no problem for the website architecture of both Web-Server and MySql-Server on the same Server. however, as the website traffic increases, the Server architecture may put the Web-Server and MySql-Server on independent servers in the later stage to improve the performance, in this case, MySql-Server must be modified to allow Web-Server for remote connection.
2. You do not need to log on to the server every time to add and modify tables. You can use a graphical interface to remotely manage the tables.
We can follow the steps below to modify:
1. log on to Mysql-Server to connect to local mysql (only local connections are allowed by default)
2. Modify the user configuration of Mysql-Server.
Mysql> USE mysql; -- switch to mysql DBDatabase changedmysql> SELECT User, Password, Host FROM user; -- view existing users, password and Host + ------ + ---------- + ----------- + | User | Password | Host | + ------ + ---------- + ----------- + | root | localhost | + ------ + ---------- + ----------- + 1 row in set (0.00 sec) mysql> -- only one default root user, the password is empty, and only localhost is allowed to connect to 12 mysql> -- Next we will add another root user, and the password is empty, only 192.168.1.100 is allowed to connect to mysql> grant all privileges on *. * TO 'root' @ '192. 168.1.100 'identified BY ''' with grant option; mysql> -- @ '192. 168.1.100' can be replaced with @ '%' to access any ip address. Of course, we can also directly UPDATE the root user Host with UPDATE, but it is not recommended. The SQL is as follows: mysql> -- UPDATE user SET Host = '2017. 168.1.100 'where User = 'root' AND Host = 'localhost' LIMIT 1;
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Change root Password
mysql> use mysql
Database changed
mysql> update user set password=PASSWORD( '123456' ) where user= 'root' ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
|