MySQL Tools

Tips and Tricks for MySQL

Backing up a database from CentOS command line:
]# mysqldump -u root -pPASSWORD the_database > the_database.sql

Restore database from CentOS Command Line:
]# mysql -u [user] -p [database_name] < [filename].sql

Update page content (useful for SSL implementation)
update my_posts set post_content = replace(post_content, ‘http://’, ‘https://’);

CREATE DATABASE database_name;

CREATE DATABASE USER (username cannot be over 16 characters):
GRANT ALL ON database_name.* TO ‘username’@’localhost’ IDENTIFIED BY ‘password’;
FLUSH PRIVILEGES; # To activate new user

Backup just stored procedures:
mysqldump -u ‘user’ -d -p’password’ –routines –all-databases > MYSqlStoredProcedures.sql