Install Mysql 5.5 on Ubuntu 12.04 - lifuzu/cafe GitHub Wiki

Installation

  1. Run the following command to install mysql programs (include client and server):

sudo apt-get install mysql-server
  1. Run the following command from a terminal prompt to check whether the MySQL server is running:

sudo netstat -tap | grep mysql
  1. Run the following command to enter mysql server (type the password you set up in step 1):

mysql -u root -p
  1. Create database, user and grant permissions:

CREATE USER 'username'@'localhost' IDENTIFIED BY '********';
CREATE DATABASE database_name;
GRANT ALL ON database_name.* TO 'username'@'localhost';
FLUSH PRIVILEGES;

List all databases which name with reviewdb as ending

mysql --user=username --password=PASSWORD -Bse "show databases like '%reviewdb'"

Backup a database

mysqldump --user=USERNAME --password=PASSWORD --single-transaction --extended-insert=FALSE --complete-insert=TRUE --order-by-primary --databases db_name > backup_database_db_name_111413.sql

Backup all databases

mysqldump --user=USERNAME --password=PASSWORD --single-transaction --extended-insert=FALSE --complete-insert=TRUE --order-by-primary --all-databases > backup_all_databases_111413.sql

##References:

  1. https://help.ubuntu.com/lts/serverguide/mysql.html
⚠️ **GitHub.com Fallback** ⚠️