

- Create database mysql 5.5 how to#
- Create database mysql 5.5 software#
- Create database mysql 5.5 code#
- Create database mysql 5.5 password#
This software and related documentation are provided under a licenseĪgreement containing restrictions on use and disclosure and are
Create database mysql 5.5 how to#
In this tutorial, you have learned how to use the MySQL CREATE USER to create a new user in the database server.Copyright © 1997, 2010, Oracle and/or its affiliates.
Create database mysql 5.5 code#
So the user bob can do everything in the bobdb database.įinally, disconnect from the MySQL Server from both sessions: mysql> exit Code language: SQL (Structured Query Language) ( sql ) The user bob can see the lists table: +-+ġ row in set (0.00 sec) Code language: JavaScript ( javascript )įourteenth, insert a row into the lists table: mysql> insert into lists(todo) values( 'Learn MySQL') įifteenth, query data from the lists table: mysql> select * from lists Thirteenth, show the tables from the bobdb database: mysql> show tables Twelfth, select the database bobdb: mysql> use bobdb Now, bob can see the bobdb: +-+Ģ rows in set (0.00 sec) Code language: JavaScript ( javascript ) Note that you will learn how to grant privileges to a user in the GRANT tutorial.Įleventh, go to the bob’s session and show databases: mysql> show databases Tenth, grant all privileges on the bobdb to bob: mysql> grant all privileges on bobdb.* to language: SQL (Structured Query Language) ( sql )

Notice that when you press Enter, instead of showing the mysql> command, the mysql tool shows the -> that accepts new clause of the statement. Ninth, create a new table called lists: mysql> create table lists(

Seventh, go to the session of the user root and create a new database called bobdb: mysql> create database bobdb Įight, select the database bobdb: mysql> use bobdb Here is the list of databases that bob can access: +-+ġ row in set (0.01 sec) Code language: JavaScript ( javascript ) Sixth, show the databases that bob has access: mysql> show databases
Create database mysql 5.5 password#
Input the password for bob and press Enter: Enter password: ******** The user bob has been created successfully.įifth, open a second session and log in to the MySQL as bob: mysql -u bob -p Third, create a new user called bob: mysql> create user identified by 'Secure1pass!' įourth, show all users again: mysql> select user from er ĥ rows in set (0.00 sec) Code language: JavaScript ( javascript ) Second, show users from the current MySQL Server: mysql> select user from er MySQL CREATE USER exampleįirst, connect to the MySQL Server using the mysql client tool: mysql -u root -pĮnter the password for the root account and press Enter: Enter password: ******** To grant privileges to the user, you use the GRANT statement. Note that the CREATE USER statement creates a new user without any privileges. The IF NOT EXISTS option conditionally create a new user only if it does not exist. Second, specify the password for the user after the IDENTIFIED BY keywords. If the username and hostname contains special characters such as space or -, you need to quote the username and hostname separately as follows: language: SQL (Structured Query Language) ( sql )īesides the single quote ( '), you can use backticks ( `) or double quotation mark ( "). If you omit it, the user can connect from any host.Īn account name without a hostname is equivalent to: language: SQL (Structured Query Language) ( sql ) The hostname part of the account name is optional. And hostname is the name of the host from which the user connects to the MySQL Server. The account name has two parts: username and hostname, separated by the sign: language: SQL (Structured Query Language) ( sql )

Here is the basic syntax of the CREATE USER statement: CREATE USER account_nameĬode language: SQL (Structured Query Language) ( sql )įirst, specify the account name after the CREATE USER keywords. The CREATE USER statement creates a new user in the database server. Summary: in this tutorial, you will learn how to use the MySQL CREATE USER statement to create a new user in the database server.
