From:http://www.cnblogs.com/easyzikai/archive/2012/06/17/2552357.html
1.mysql-server only allow native (localhost, 127.0.0.1) to connect access for security reasons. This is not a problem for the site architecture of Web-server and Mysql-server on the same server. However, as the site traffic increases, the late server architecture may place web-server and mysql-server on separate servers for greater performance, at which point Mysql-server is modified to allow web-server remote connections.
2. Do not log on to the server every time to add the modified table, as long as the graphical interface can be remotely managed.
We can modify the following steps as follows:
1, login mysql-server to connect to local Mysql (only local connection is allowed by default)
2. Modify Mysql-server User Configuration
mysql> use MySQL; --Switch to MySQL dbdatabase changedmysql> SELECT user, Password, Host from User; --View existing user, password and allow connected host +------+----------+-----------+| User | Password | Host |+------+----------+-----------+| root | | localhost |+------+----------+-----------+1 row in Set (0.00 SEC) Mysql>--only one default root user, password is empty, allow only localhost connection 12mysql>--below we add a new root user, password is empty, only allow 192.168.1.100 to connect my Sql> Grant all privileges on * * to ' root ' @ ' 192.168.1.100 ' identified by ' with GRANT OPTION; Mysql>-@ ' 192.168.1.100 ' can be replaced by the @ '% ' for any IP access, of course, we can also update the root user Host directly with update, but not recommended, SQL is as follows:mysql>--Update user SET host= ' 192.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) |
MySQL open remote access to root, change root password