MySQL Basics-Database basic operations

Source: Internet
Author: User

1. Delete the database name of the drop databases database;

mysql> drop database test;

That is, delete the database schema

2 . Create DATABASE Database name

mysql> CREATE DATABASE test;

Windows and Linux handle database names and table names differently, in Windows is case-insensitive, and in Linux are case-sensitive

3 Creating a dedicated user for the operational database

Syntax rules:

Create a new user and give it permissions to the database grant all privileges the on database name. * To user name @localhost identified by password

Mysql> GRANT all privileges in test * to user$localhost identified by ' 12345 ';

This gives the user who connects to the database locally all the permissions (all privileges) to operate on all objects in the home database. A permission is a measure of what a user can do with a database, specifically by creating a SELECT (retrieve) update (UPDATE) Delete (delete), and so on. In addition, the [test.*] section, for specific table operations in the database

4 Logging in to the database using user users

mysql>-U user-p

Enter Password: ******

5 specifying the database to use

Use the specified database using the database name

mysql> use home;

6 When using the MySQL monitor, forget the specified database, you can use the Select command to view the database now in use

Displays the database that is currently in use, SELECT databases ();

Mysql> Select Database ();

MySQL Basics-Database basic operations

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.