Depressing. One server, linux + apache + mysql + php, is installed with phpmyadmin.
Use phpmyadmin to access the server
However, I wrote my own php
The connection to the database says the target machine is actively rejected. Unable to connect .......
$username = "Test"; $psword = "123456"; $hostname = "10.12.18.27"; $dbName = "TestDb"; $server_link = mysql_connect("$hostname","$username","$psword") or die("Can't connect to server" . mysql_error());
There is a problem with this sentence ............. Oh, no.
With the root account or Test account, you can log on to phpmyadmin normally.
The only difference is that phpmyadmin is on the server.
My php code is on my computer (Apache + php + win7)
Besides, the Test account, what remote login, and any location login function are all enabled ......
Reply to discussion (solution)
You are not authorized to enable mysql remote connection.
You are not authorized to enable mysql remote connection.
Do you mean User rights?
%
Localhost
127.0.0.1
Host Name
These four are all open.
Previously, it was normal.
The server is restarted.
That's it.
You can use sqlyog or the command line to connect. Check whether the connection is successful.
You can use sqlyog or the command line to connect. Check whether the connection is successful.
Code 2003
Host entry of the user table in the mysql database, renamed from localhost to %
Or add a new record. the host entry is your local IP address and is authorized.
Restart mysql service
Rules:
Use the GRANT command
If you want myuser to use mypassword to connect to the mysql server from any host.
Grant all privileges on *. * TO 'myuser' @ '%' identified by 'mypassword' with grant option;
If you want to allow myuser to connect to the mysql server from a host whose ip address is 192.168.1.3, and use mypassword as the password
Grant all privileges on *. * TO 'myuser' @ '192. 168.1.3 'identified BY 'mypassword' with grant option;
Host entry of the user table in the mysql database, renamed from localhost to %
Or add a new record. the host entry is your local IP address and is authorized.
Restart mysql service
Rules:
Use the GRANT command
If you want myuser to use mypassword to connect to the mysql server from any host.
Grant all privileges on *. * TO 'myu ......
I cannot understand why.
I deleted the account test and created another test. the permissions are the same.
%
Localhost
127.0.0.1
Host Name
Reference reply from xuzuning on the 5th floor: host entry of the user table in mysql database, renamed from localhost %
Or add a new record. the host entry is your local IP address and is authorized.
Restart mysql service
Rules:
Use the GRANT command
If you want myuser to use mypassword to connect to the mysql server from any host.
Grant all privi ......
Restart MYSQL again.