Depressed problem, very depressed.
There is a server linux+apache+mysql+php another phpmyadmin installed
Use phpMyAdmin to access the server normally
But I wrote php myself.
Connecting the database says the target machine is actively rejecting. Unable to connect ....
$username = "Test";
$psword = "123456";
$hostname = "10.12.18.27";
$server _link = mysql_connect ("$hostname", "$username", "$psword")
This sentence will be a problem ...... Mother, there's no justice.
With root or test account, the phpMyAdmin can be logged in normally.
The only difference is that phpmyadmin on the server.
My PHP code is on my Computer (apache+php+win7)
Again test account, what remote login, arbitrary location login function all open ...
------Solution--------------------
No permissions to open MySQL remote connection
------Solution--------------------
You can use SQLyog or command line to connect to see. See if you can connect successfully.
------Solution--------------------
The host entry for the user table in the MySQL database, renamed% from localhost
Or a new add-on record, the host entry is your local IP address, and you authorize
Restart MySQL Service
Rules of Practice:
Using the GRANT command
You want MyUser to use MyPassword to connect to the MySQL server from any host.
GRANT all privileges on * * to ' myuser ' @ ' percent ' identified by ' MyPassword ' with GRANT OPTION;
If you want to allow users to connect to the MySQL server from a host myuser IP 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;