Difference between revisions of "MySQL Databases"

From Run Your Own
Jump to: navigation, search
(Created page with "Some MySQL handy oneliners: * List all users from running instance: SELECT User, Host, Password FROM mysql.user; * Create new user called <code>newuser</code> CREATE USER n...")
 
Line 5: Line 5:
 
* Create new user called <code>newuser</code>
 
* Create new user called <code>newuser</code>
 
  CREATE USER newuser@localhost IDENTIFIED BY 'superstrongpassword';
 
  CREATE USER newuser@localhost IDENTIFIED BY 'superstrongpassword';
 +
* Creat new UTF-8 database called <code>mydatabase</code>
 +
CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  
  
  
 
[[Category:Database]]
 
[[Category:Database]]

Revision as of 13:21, 24 February 2019

Some MySQL handy oneliners:

  • List all users from running instance:
SELECT User, Host, Password FROM mysql.user;
  • Create new user called newuser
CREATE USER newuser@localhost IDENTIFIED BY 'superstrongpassword';
  • Creat new UTF-8 database called mydatabase
CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;