I think this "root@localhost" thing is not the problem. "localhost" should be a valid name for every computer referring to itself no matter what its actual name is. Likewise the IP-address 127.0.0.1 always refers to the computer itself, no matter what its actual IP-address is.
It sounds like you have put the password in "/etc/mysql/my.cnf" (or on RedHat purhaps "/etc/my.cnf" or whatever place within /etc). This is not a good idea, and probably won't work. You should put it in a file called ".my.cnf" (notice that the file name starts with a dot) in your home-directory, and use the original /etc/mysql/my.cnf.
So, restore the original "my.cnf", restart the mysqld server (or reboot if you don't know how to do this) and create a /root/.my.cnf (notice the dot) that just reads:
[mysql]
user = root
password = <your password>
[mysqladmin]
user = root
password = <your password>
After creating it do a "chmod 0700 /root/.my.cnf" (important for security).
Log into your Linux system as root. Now you should be able to start "mysql" just like that, without any further commandline options. Type the SQL-command "SELECT USER();" to verfiy that you are really logged in to MySQL as "root@localhost".
You can do this for normal user accounts on your Linux system as well, provided you have created the user names in MySQL (with GRANT ....).
If this still doesn't work then try the -p option to the mysql command, to have it explicitly ask for your password, i.e. "mysql -u root -p".


Reply With Quote
Bookmarks