When the MySQL service starts, not only listens to the Ip:port, but also listens to a socket, our installation mysql is the monitor
Listen to the/tmp/mysql.sock. If PHP is local, then PHP and MySQL communication can be communicated through the socket, such as
If the result is remote, it needs to communicate via TCP/IP. Under the Linux command line, we can use the following method to connect the
Connect to the MySQL server.
(1) How TCP/IP is
mysql-uroot-h192. 168.1. 117 -p3306-p123456
-H Specify IP
-P Specify port
-P Specify password
If the error says: Do not allow the link MySQL server, the IP to 127.0.0.1 to try, because has been authorized. Now give 192.168.1.117 authorization.
Enter in the MySQL command
' Root ' @'192.168.1.117'123456';
All so the permissions
*. * Library. Table
Authorization to Root
Client IP server is 117, customer service may be 116 115
Finally with the password
Select a bit
Select Database
Use MySQL
Select from where host='192.168.1.117'\g;
has been successfully authorized, and then to link
mysql-uroot-h192. 168.1. 117 -p3306-p123456
View the currently logged on user
Select User ();
(2) Socket mode
This is only suitable for connecting to the native MySQL, the command is:
Mysql-uroot-s/tmp/mysql.sock-pwangshaojun
LAMP 3.2 MySQL Login