Posts Tagged ‘mysql’

Check if / Make a MySQL instance read only

January 8, 2013

To check if A DB is already in read only mode:

SELECT @@global.read_only;

To set ( at Runtime)

SET GLOBAL read_only=1;

To set permanently,  add the following in my.cnf


These options will  make the DB run  in a read only mode, except for the slave threads and the super users, who can still do writes.  This is used on slaves when you want to make sure only read requests are executed on slaves.

Reset MySQL root password – Linux

August 6, 2008

1. Stop the MySQL service as root.

# /etc/init.d/mysql stop
#service mysql stop

2. Start MySQL in safe mode and skip “grant tables”:
# /usr/bin/mysqld_safe –user=mysql –socket=/var/lib/mysql/mysql.sock –pid-file=/var/run/mysqld/ –datadir=/var/lib/mysql –skip-grant-tables –skip-networking &
3. Now, reset the MySQL root password using mysqladmin
# mysqladmin -u root flush-privileges password new_password_here
4. Stop MySQL running in safe mode:
#kill `cat /var/run/mysqld/`
5. Start MySQL:
#/etc/init.d/mysql start
6. You can use the new MySQL root password now :
#mysql -u root -p
When prompted for the new password, enter the new password you have set using mysqladmin

How to convert charecterset :: mysql

February 2, 2008

Two very useful links :