MySQL creating a database and user from the console

Here is how to quickly create a database and add a user to a mysql database (the mysql console).
(Yes some values need to be changed)

  • mysql> use mysql;
  • mysql> CREATE DATABASE dbname;
  • mysql> INSERT INTO user (Host,User,Password) VALUES (‘localhost’, ‘username’, PASSWORD(‘password’));
  • mysql> GRANT ALL ON dbname.* TO ‘username’;
  • mysql> FLUSH PRIVILEGES;
  • mysql> exit

Update: This approch will not work when using MySQL server under Windows.

2 thoughts on “MySQL creating a database and user from the console

  1. Pingback: Naruto Ipod Thingy | Bad Credit - Loans, Repairs, Help, Mortgage news and information.

  2. Pingback: MySQL creating a database and user from the console « Jontas blog …

Comments are closed.