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

“read_only”

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
or
#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/mysqld.pid –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/mysqld.pid`
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 :

http://codex.wordpress.org/Converting_Database_Character_Sets
http://www.mydigitallife.info/2007/06/23/how-to-convert-character-set-and-collation-of-wordpress-database/