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.

I installed mysql on ubuntu server and i dont know what went wrong...it didnt install a mysql root user so i tried to uninstall and start over and now i cant unistall

i tried this

apt-get remove php5-mysql
apt-get remove mysql-server mysql-client
apt-get autoremove

but when i do

ps aux | grep mysql
root      6066  0.0  0.0   1772   540 pts/1    S    03:21   0:00 /bin/sh /usr/bin/mysqld_safe
mysql     7065  0.0  0.6  58936 11900 pts/1    Sl   03:33   0:00 /usr/sbin/mysqld --   basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid -- socket=/var/run/mysqld/mysqld.sock --port=3306
root      7066  0.0  0.0   2956   688 pts/1    S    03:33   0:00 logger -t mysqld -p daemon.error
root     22804  0.0  0.0   3056   780 pts/1    R+   04:14   0:00 grep mysql

so i killed the processes and then tried to reinstall like this

apt-get -f install
sudo apt-get install mysql-server mysql-client
sudo mysqladmin -u root -h localhost password 'root'

but i get this

mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

im confused..i keep installing and uninstalling mysql and the same result..any ideas

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

Try:

sudo /etc/init.d/mysql stop
sudo mysqld --skip-grant-tables &
mysql -u root mysql
mysql>UPDATE user SET Password=PASSWORD('PASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
sudo killall mysqld
sudo /etc/init.d/mysql start
share|improve this answer
    
i get a fail on sudo /etc/init.d/mysql stop –  Matt Feb 4 '11 at 4:54
    
Try 'sudo killall mysqld'. –  alvosu Feb 4 '11 at 4:56
add comment

I think you should try dpkg-reconfigure mysql-server-5.1 (not sure about exact version of the package, I don't have an Ubuntu box here right now, it depends on Ubuntu version anyway, so you'd better check it using dpkg -l | grep mysql-server). dpkg-reconfigure resets a root password on Debian, I assume its behaviour is the same on Ubuntu.

share|improve this answer
add comment

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.