Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Tuesday, 1 October 2013

Error in Kloxo: Could not open database connection

If you get the below error while trying to access Kloxo Control Panel

Could not open database connection

You can fix it by excecuting below commands from the server.

#mysql -u root -p
mysql> grant all on kloxo.* to kloxo@localhost identified by '{new password}';
mysql> flush privileges;
mysql> quit
Then do,

#cat "{new password}" > usr/local/lxlabs/kloxo/etc/conf/kloxo.pass
#sh /script/restart
Replace "new password " with your password in above commands.

This will fix the issue !!!


Tuesday, 24 September 2013

ERROR! MySQL manager or server PID file could not be found!

Some times you may get mysql error on the page. And on checking the status of the mysql, if you are getting following error 

# /etc/init.d/mysqld status
ERROR! MySQL manager or server PID file could not be found!
Then the Fix is below.

Check the file /etc/my.conf and see any thing mentioned as " basedir= ". If nothing mentioned in the file, by default it would be /var/lib. Then, check the permission for /var/lib/mysql and make sure all are having user and group " mysql ". If not do
#chown -R mysql.mysql /var/lib/mysql
Then, restart mysql
#/etc/init.d/mysql restart
This should fix the issue.






Thursday, 25 July 2013

how to change mysql password for an user

Suppose you have got a user " db_user " and you have lost the password for the user. You need to reset it. For this just follow the steps bellow.

Get into the server as root, then get into mysql as root user.

#mysql -u root -p******

Where ***** should be replaced with your password for mysql root user.

Then execute the following commands.
mysql> use mysql;

mysql> SET PASSWORD FOR 'db_user'@'localhost' = PASSWORD('new-password'); 
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
           Query OK, 0 rows affected (0.00 sec)
mysql>quit
Now the password will be reset to  new-password for the user db_user.



Saturday, 3 September 2011

How to reset mysql root password

You can reset the MySQL root password using the following command if know the current root password

root@amaziah [~]#mysqladmin -u root -p 'current password' password 'new password'

If you don't know the  root password then, follow the below steps

First stop MySQL server,

root@amaziah [~]#service mysql stop
                    OR
root@amaziah [~]#/etc/init.d/mysql stop


Then edit the following file,

root@amaziah [~]#vi /etc/rc.d/init.d/mysql

edit the line, 

$bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &
To
$bindir/mysqld_safe --skip-grant-tables --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &

Then start the MySQL server,

 root@amaziah [~]#/etc/init.d/mysql start

Once the MySQL server is started, you can login to MySQL as root user without password

root@amaziah [~]#mysql -u root mysql

Then enter the following command to set new password for root,

mysql>UPDATE user SET password=PASSWORD ('new password') WHERE user='root';
mysql>flush privileges ;
mysql>quit

Now you have to stop the MySQL server and edit /etc/rc.d/init.d/mysql and change it to as it was before. ie. change the line 

$bindir/mysqld_safe --skip-grant-tables --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &
To
$bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &

Once this has been done, start the MySQL server.

root@amaziah [~]#/etc/init.d/mysql start

Done. Now you can login to MySQL using the new password that you have set.