2009年8月4日 星期二

MySQL ERROR 1045

 

After install LAMP , start mysql fail and user table empty

[root@devphp ~]# mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)



Solution:

mysql 資料庫名稱 -u使用者名稱 -p密碼

tail -f  /var/log/mysqld.log

Re-Install MySQL
yum -y  remove mysql mysql-server php-mysql
yum -y  install  mysql mysql-server php-mysql

service mysqld stop
/usr/libexec/mysqld --skip-grant &
mysql -u root mysql
mysql> use mysql ;
mysql> show tables;
mysql> insert into user values
('localhost','root',password('123'),
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'
,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'
,'Y','Y','Y','Y','Y','Y'
,'','','',''
,0,0,0,0);
mysql> quit ;

shell>kill -9  3769 (mysql pid)

shell>service mysqld start

mysql -uroot -p

沒有留言: