jamesdeakin.com

Icon

digital marketing consultant

Create a MYSQL database via linux command line

If you need to create a MYSQL database on a linux server and you don’t have PhpMyAdmin installed but you have command line access you can do so by following these steps. The commands to enter are in orange and things where you need to enter your own details are in blue.

mysqladmin -u root -p create yourdatabasename

mysql -u root -p

You do not want to have your application use the mysql root user to access the database. The below command creates a mysql user (other than the mysql root user) with some priviledges to use the drupal database. You should pick something different yourdatabaseuser and yourdatabasepassword you can use anything you like.

mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON yourdatabasename.* TO ‘yourdatabaseuser‘@’localhost’ IDENTIFIED BY ‘yourdatabasepassword‘;

If the command was successful, activate the new permissions with the following command:

mysql> FLUSH PRIVILEGES;

Quit the mysql prompt:

mysql> \q

here is a handy reference http://www.pantz.org/software/mysql/mysqlcommands.html

Get Adobe Flash playerPlugin by wpburn.com wordpress themes