Enable remote connection to MySQL database on Debian
I have installed MySQL database in Debian Lenny 5.0 and I am trying to connect to this database remotely using PHP.
This is how I log in:
$con = mysql_pconnect("MY_IP_ADDRESS","root","MY_PASSWORD");
if (!$con)
die('Could not connect: ' . mysql_error());
and this is the error i am getting:
Could not connect: Access denied for user 'root'@'li273-10.members.linode.com'
(using password: YES)
Which I'm not sure why my linode user came up.
To enable remote connections I used this tutorial: http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
Another thing I noticed, in my phpmyadmin on the MySQL side, I have the following:
Server: localhost via TCP/IP
Server version: 5.0.51a-24+lenny5
Protocol version: 10
User: root@mycooldb
What do I think localhost should be my server IP?
What am I doing wrong?
A bit that doesn't work from the tutorial:
Keeping All Rules: service iptables save
Doesn't Work. I am getting this error:
-bash: service: command not found
Finally, when I do mysql -u webadmin -h MY_IP -p, I get this:
source to share
You also need to create user / permissions for the remote user. Probably the root user has permissions defined only as root @ localhost.
You will need to define custom permissions, for example: user @% or user@li273-10.members.linode.com.
http://dev.mysql.com/doc/refman/5.0/en/create-user.html
You probably don't want to provide remote access to the superuser (root in this case).
Your hostname appears in the authentication string because you are actually connecting to the db as user @hostname.
source to share