Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Thursday, July 05, 2012

Show running queries if MySQl is stuck

Sometimes we want to know which query causes the DB to be so slow. Here is the magic MySQL queries which can do it:
 
show processlist;
 
Look into "info" column listed in the output table to see what queries are working now.

Saturday, June 23, 2012

Repair ALL tables in a MySQL DB schema

Here is how to do it with the help of 'information_schema' of MySQL:

select concat('repair table ', table_name, ';') from information_schema.tables where table_schema='my-db-schema-name';

Thursday, June 30, 2011

Installing MYSQL on RedHat Enterprise Linux RHEL 6.1

Get MySQL here: http://www.mysql.com/downloads/mysql/#downloads


Select TAR installation if available, get the link of TAR and run
wget [link]

Uncompress
 tar -xvf MySQL-5.5.13-1.rhel5.x86_64.tar


Install server:
rpm -Uvh MySQL-server-5.5.13-1.rhel5.x86_64.rpm

Install client:
rpm -Uvh MySQL-client-5.5.13-1.rhel5.x86_64.rpm


Note this warning:
----------------------
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h ip-10-34-70-147 password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

-----------------------------------

Start MySQL:
service mysql start

Monday, February 02, 2009

Adding a new user to mySQL DB with phpMyAdmin

In addition to the graphical UI provided by phpMyAdmin, you can just issue the following SQL:
GRANT ALL ON DB-NAME.* TO IDENTIFIED BY '';

replace by teh user name you want, e.g. fernandotorres and replace by the password for this user. Note that there are ' signs around the password - keep them.

http://www.trap17.com/index.php/adding-users-databases-using-phpmyadmin_t31803.html