Command for creating a new user in mysql

Source: Internet
Author: User

Log on to the database
Input in the "command prompt character" window,
Enter cd C: mysqlbin and press the Enter key to switch the directory to cd C: mysqlbin.
Enter the mysql-uroot-p command and press enter to prompt you to enter the password. If MYSQL is just installed, the Super User root has no password, so press enter to enter MYSQL, MYSQL prompt: mysql> Change Password
C: input at mysqlbin prompt:
Format: mysqladmin-u username-p old password New password
For example, add a password ab12 to the root user. Type the following command:
Mysqladmin-uroot password ab12
Create a database
Format: create database name;
For example, create a new database named shopex.
At the MYSQL prompt: mysql> enter create database shopex;
Show Database
Format: show databases;
Note that it is databases instead of database.
Create a new user
Format: grant all privileges on database. * to username @ login host identified by "password ";
For example, add a user named test with a password of 1234 so that he can only log on to localhost and perform all operations on the database Shopex (localhost refers to the local host, that is, the host where the MYSQL database is located.) At the MYSQL prompt: mysql> enter grant all privileges on shopex. * to test @ localhost identified by "1234 ";
Through the above operations, you create a new database named shopex and add a database named test with all operation permissions on the shopex database.
Note: The preceding is just a simple Mysql Operation Command. For more details, see the Mysql operation instructions.

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.