You are not logged in.

#1 2008-07-20 11:03:12

cywhale
Member
Registered: 2008-03-10
Posts: 31

[SOLVED] MySql: Access denied for user 'root'@'localhost'

Hello.
After installing and using MySql for many times (Ubuntu, Fedora and Arch Linux) something goes wrong now. Had to reinstall Arch yesterday, now everything works fine again except MySql.

- Installed MySql using pacman -S, worked.
- Starting using /etc/rc.d/mysql start, works.

- /usr/bin/mysqladmin -u root password 'new-password' gives the error message 'Access denied for user 'root'@'localhost'
- same error for /usr/bin/mysqladmin -u root -h HAL password 'new-password'

Now I searched through the web and tried

- removing mysql using pacman -Rc mysql (hopefully deleting old passwords?)
- reinstalling recent mysql and older version from February - same results.
- same error with and without 'skip_networking' in /etc/my.cnf
- tried using mysqld_safe & - same error
- /var/log/mysqld.log seems to be empty
- tried the following:

[cywhale@HAL ~]$ sudo mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h HAL password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[cywhale@HAL ~]$ sudo /usr/bin/mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Enter current password for root (enter for none): 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none): 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
...
Aborting!

It seems there is either no root user and I am not able to create one or there is a password which i cannot remove for the root user. Arch Linux has been installed on a clean partition yesterday, during all previous arch installations since a few months there was NEVER a problem installing and using mysql.

Any help would be greatly appreciated, i need MySql for web developing purposes and do not want to switch to another distribution again...

Last edited by cywhale (2008-07-20 13:06:29)

Offline

#2 2008-07-20 11:58:22

cywhale
Member
Registered: 2008-03-10
Posts: 31

Re: [SOLVED] MySql: Access denied for user 'root'@'localhost'

Hrmpf. Somehow I knew posting this there'll be a solution very soon. Found it.
So if anyone has a similar problem, this is how it was solved here:

- Removed /var/lib/mysql (found this hint here @ bbs.archlinux.org 3 or 4 pages ago)

sudo rm -r /var/lib/mysql

- Removed mysql using '-n' parameter (deleting all configuraion files)

sudo pacman -Rn mysql

- Reinstalled mysql

sudo pacman -S mysql

- Install basic tables

sudo /usr/bin/mysql_install_db

- Secure installation

sudo /usr/bin/mysql_secure_installation

Worked this time. I still do not know what exactely the error was all about. Any idea?

Last edited by cywhale (2008-07-20 11:59:21)

Offline

#3 2008-07-20 12:05:08

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [SOLVED] MySql: Access denied for user 'root'@'localhost'

Please add [SOLVED] to the thread title.


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#4 2008-07-20 13:07:03

cywhale
Member
Registered: 2008-03-10
Posts: 31

Re: [SOLVED] MySql: Access denied for user 'root'@'localhost'

Done. Thank you.

Offline

#5 2008-10-05 15:33:46

pinr
Member
Registered: 2006-09-07
Posts: 11

Re: [SOLVED] MySql: Access denied for user 'root'@'localhost'

Thanks for this solution!

Offline

Board footer

Powered by FluxBB