mysql root connection Qs - shell and remote

marcm

Member
hello again,

Hopefully someone can shed some light on a few questions I have.

First of all, when logged in to my server as root via shell, I can access MySQL without a password. I have definitely created a root password for the MySQL server. So, is this a feature?

Also, when accessing my databases remotely, I can't use my IP or the connecting host, I have to use % - which kinda sucks. My IP is fixed, so I don't know why the IP doesn't work.

Finally, I can't connect as root to the MySQL server remotely. I know this is for security purposes, but if I can't grant root access by IP, what can I do to connect remotely - besides adding a wildcard % ?

Any thoughts on this? Cheers - Marc
 
Marc,

MySQL root password is stored in the /root/.my.cnf file and is being used every time when you run "mysql", "mysqladmin", "mysqlcheck" and other mysql command line tools while you're logged in as root. Also, the same file is being used by cPanel to obtain MySQL root password every time when any kind of database related operation is requested through the control panel.

I haven't heard about such problem before. Do you see current IP records in the "host" filed in the "user" table in the "mysql" database? This can be seen in the output of:

mysql mysql -e "select Host from user where User = 'root' "

If IP is correct try to run "mysqladmin flush-privileges" and try to reconnect.
 
Top