MySQL

From Notepedia
Jump to: navigation, search

MySQL

Logging into the MySQL command prompt

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 963
Server version: 5.1.49-log SUSE MySQL RPM

mysql>


Basic show commands

mysql> show databases;
mysql> connect mythconverg;
mysql> show tables;


Create Wordpress Database

mysql> CREATE DATABASE blahDB;
mysql> GRANT ALL PRIVILEGES ON blahDB.* TO "wordpress-user"@"localhost" IDENTIFIED BY "XXXXXXXXX";
mysql> FLUSH PRIVILEGES;

Create MySQL Dump

$ mysqldump --user=db_user --password=db_userpassword db_name > backup_file.sql

Other useful references