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 Responses to “MySQL creating a database and user from the console”

  1. [...] MySQL creating a database and user from the console « Jontas blog … [...]

  2. [...] the original post: MySQL creating a database and user from the console « Jontas blog … Posted in Uncategorized | Tags: console, from-the-console, quickly-create, [...]

Leave a Reply