问题
I've two machine.
Machine 1 (Server) : MySQL Server installed on it.
Machine 2 (Client) : MySQL Server not installed on it.
I would like connect from Machine 2 (Client) to MySQL Server on Machine 1 (Server).
I did following command on Machine 1 (Server) to grant permission to all clients :
GRANT ALL ON *.* TO root@'%' IDENTIFIED BY '123456';
Well, I need to connect MySQL Server from Client.
I've write below command in cmd
on Machine 2 (Client) :
mysql -h 192.168.0.1 -u root -p
192.168.0.1 on above line is Machine 1 (Server) IP.
But following error has occur :
`mysql` is not recognaized as an internal or external command, operable program or batch file.
I guess need to install something like mysql connector or something else on Machine 2 (Client), isn't it ?
回答1:
You can use other tool with good looking GUI. For example: HeidiSQL.
Then, you need to enable remote access. If you use windows, there is nice wizard for you to enable remote access with a few clicks. The wizard is located it at MySQL Server 5.5\bin\MySQLInstanceConfig.exe
. Then
Reconfigure Instance -> Next -> Standard Configuration -> Next -> Next
. You will see this screen.
Tick on "Enable root access from remote machines". Or you can manually configure it to allow remote access from my.ini
file. See this link for how to do it.
If having done above still does not allow you to connect to your MySQL. Please make sure that Firewall does not block MySQL port.
回答2:
I can give you an idea to do it,
1st: You have to give permission from machine 1 for machine 2. You should edit httpd.conf
file
Listen machine 2 ip
(192.168.0.*)
2nd: You have to give permission for phpmyadmin by following code-
GRANT ALL PRIVILEGES ON Database.* to 'username'@'ip or url' IDENTIFIED by 'password';
You can check @ http://www.cyberciti.biz/faq/mysql-connection-from-other-machine/
来源:https://stackoverflow.com/questions/17018772/connecting-clients-machine-to-mysql-server-machine