Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

its been a couple of days that I'm trying to install mysql on my vps which has debian 5.0 with 256mb ram. I've installed webmin also. here is the symptoms : after installing mysql using either webmin or apt-get I am trying to connect to mysql for changing root password but every time I cope with this error :

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

so I start to investigate and I understand there is no root user inside mysql database when I use :

UPDATE user SET password=PASSWORD('newpassword') WHERE user="root";

it says 0 row affected

I reinstall mysql for several times but the same problem still exits. please help me how can I install mysql-server as well as mysql-client correctly.

regards.

share|improve this question

3 Answers 3

Debian mysql-server package does not set mysql root password on install, so you should be able to login from command line by simply typing mysql and hitting Enter.

Also, you do not need to reinstall mysql all the time, to reconfigure it you can just run dpkg-reconfigure mysql-common.

share|improve this answer
    
thats what I'm asking about when I try to login to mysql console I'll get this error : ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) also I've tried the mysqld_safe --blah blah and its not fix anything. the real problem is with my mysql database because I get this error during starting the mysql service : Checking for corrupt, not cleanly closed and upgrade needing tables.. and I almost forgot to say about my debian I've downloaded it from stacklet.com. –  austin powers Apr 15 '10 at 20:23
1  
Checking for corrupt, not cleanly closed and upgrade needing tables is not an error. This is a legit message, telling you what mysql is doing :). Your original post said "(using password: YES)" so i assumed you are using a password. Check /etc/mysql/debian.conf, it should have an account info for debian-sys-maint user. Use that to login into mysql and re-setting root password. mysql -h localhost -u debian-sys-maint -p –  solefald Apr 15 '10 at 20:30
    
so I cat the debian.cnf (there is no .conf) here is the result user = debian-sys-maint password = kBB4qBvO9iMbMf6D socket = /var/run/mysqld/mysqld.sock basedir = /usr and when I type : su debian-sys-maint I will get this error : Unknown id: debian-sys-maint I don't get it what is the exact problem? is it stacklet's debian problem or mine??? and just to reminind I have the same problem when I use webmin also. –  austin powers Apr 15 '10 at 20:41
1  
Good idea about using the debian.cnf. Instead of looking at the file you can just start the mysql client using that config file with a command like mysql --defaults-extra-file=/etc/mysql/debian.cnf. –  Zoredache Apr 15 '10 at 20:42
1  
@austin powers, I think we may have identified your confusion. Usernames and passwords withing mysql have absolutely no relationship to users on your local system. Your mysql root account is completely seperate from your systems root account. Using su debian-sys-maint would not do anything useful because that is a mysql account not a system account. –  Zoredache Apr 15 '10 at 20:44

I would use a command to list all the mysql packages. dpkg --get-selections | grep 'mysql-' | awk '{print $1}'. Then I would use apt-get purge package1 package2 ... packagen to remove.

Finally make sure everything is removed from /var/lib/mysql/.

share|improve this answer
    
so I have done what you saying , just one thing I am logged in as root user but the mysql/ owned by mysql user doesn't it make any problem? and one more thing , for installing mysql i will use this command : apt-get install mysql-server mysql-client. is it enough ? regards –  austin powers Apr 15 '10 at 20:15
up vote 0 down vote accepted

thanks for all of your advice , I've fixed it . it was all about /tmp permission the permision of this folder shoulbe be 0777 but mine was 0775 or something like that.

regards.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.