MySql error 1045 (28000) access denied

July 8, 2008

I installed Trixbox onto my Dell machine. I wanted to write an application to access database acoompanied trixbox. This was MySql based. I opened ssh session to the machine, logged-in and tried to open MySql prompt and I got the following error:

[trixbox1.localdomain ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user
‘root’@'localhost’ (using password: YES)

I searched net and finally came to solution this way:

[trixbox1.localdomain ~]# /etc/init.d/mysqld stop
Stopping MySQL:                                            [  OK  ]
[trixbox1.localdomain ~]# mysqld_safe –skip-grant-tables &
Starting mysqld daemon with databases from /var/lib/mysql
[trixbox1.localdomain ~]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.22

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> UPDATE mysql.user SET password=”" WHERE User=’root’ AND Host=’localhost’;
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> quit
Bye
[trixbox1.localdomain ~]# ps xf | grep mysql
 4257 pts/0    T      0:00          \_ /bin/sh /usr/bin/mysqld_safe –skip-grant-tables
 4663 pts/0    S+     0:00          \_ grep mysql
 4609 pts/0    S      0:00 /bin/sh /usr/bin/mysqld_safe –defaults-file=/etc/my.cnf –pid-file=/var/run/mysqld/mysqld.pid –log-error=/var/log/mysqld.log
[trixbox1.localdomain ~]# kill -9 4257
[trixbox1.localdomain ~]# kill -9 4609

[1]+  Killed                  mysqld_safe –skip-grant-tables
[trixbox1.localdomain ~]# /etc/init.d/mysqld start
Starting MySQL:                                            [  OK  ]
[trixbox1.localdomain ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.22

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> quit
Bye

I hope, this solves your problem too.


LAMP

June 27, 2008

My first post on this blog is rightly selected – lamp! My name is Chirag and its meaning in Indian languages viz. Sanskrut/Gujarati or even in Urdu/Arabic, is lamp.

Nowadays in USA, we have a choice of buying “day light” energy saver lamps at Home Depot or similar stores. These spiral “day light” energy savers are real energy savers. I have saved tens of bucks on electricity every month.

Today, I am talking about a different LAMP which you might be aware of already. Linux + Apache + MySQL + PHP. It’s about free software movement. If you have LAMP, virtually everything used on computers can be created! I am serious.

At the same time, I am an ardent fan of Microsoft movement as well. It’s not about capitalism only or not being greedy. It has more to do with simplicity in action. If you can visualize bell jar curve, you will rightly understand that major area of that curve is occupied by middle portion of the curve. Say, right side 10% is for very naive people like artists. They want very very simple application and that domain is captured by MAC. Then, there is 10% portion of the curve in left side, which is for “intellectuals”. They know what they are doing and nobody else understands that. This domain is ruled by LAMP! The rest 80% portion is captured by Microsoft! This is area comprising common people. They need some power and much simplicity!!!

I will try to explore LAMP and Microsoft Windows in coming posts. Happy reading (or happy getting bored…)