MySQL Create a new user command

Source: Internet
Author: User
Tags mysql create create database mysql database mysql database hosting

Log on to the database
"Command prompt character" window entry,
Input CD C:mysqlbin and press ENTER to switch directory to CD C:mysqlbin
And then type the command mysql-uroot-p, enter after the prompt you to lose the password, if just installed MySQL, superuser root is no password, so direct return can enter into MySQL, MySQL prompt is:mysql> modify password
C:mysqlbin Prompt Entry:
Format: Mysqladmin–u username-P Old password password new password
For example: Add a password to root ab12. Type the following command:
Mysqladmin-uroot Password AB12
Building a Database
Format: Create database library name;
For example: Create a new database Shopex
In the MySQL prompt:mysql> input create database Shopex;
Show Database
Format: show databases;
Attention is databases, not database.
Create a new user
Format: Grant all privileges on database. * To User name @ login host identified by "password";
For example: Add a user test password of 1234, so that he can only log on localhost, and can do all the operations on the database Shopex (localhost refers to the local host, that is, the MySQL database hosting the host), Under the MySQL prompt:mysql> entry grant all privileges on shopex.* to test@localhost identified by "1234";
By doing this, you create a new database Shopex and add a name to the Shopex database with all the permissions to operate.
Note: The above is just a simple mysql operation command, if you need to know more detailed information, please check the MySQL related operation instructions documentation.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.