Thursday, December 31, 2009

Issues while starting mysql server

I have installed mysql server again in my local machine and I was trying to start the same using /etc/init.d/mysqld start and I was getting error saying "Timeout" and when I looked into /var/log/mysqld.log, it is giving error as the db is corrupted or not shutdown properly previously. And after doing some other fixes, I was getting "Can't open and lock privilege tables: Table 'mysql.host' doesn't exist" So to resolve this, I have removed the datadir altogether and have executed below commands:

/usr/bin/mysql_install_db --user=mysql --ldata=/new-data-location
and once that is succeeded, I tried to start with
mysqld_safe --datadir=/new-data-location --user=mysql &
and I got below error saying it couldn't create .pid file in /new-data-location/mysqld. So, I had to manually create mysqld directory in new-data-location and change ownership to mysql and re executed above command and everything went fine.

Now, I changed the root password using the secure installation script(mysql_secure_installation) available in bin folder and everything is fine now.

No comments: