MySQL Foundation-Basic database 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;

In Windows and Linux the processing of database names and table names is different, and in Windows it is not differentiated between uppercase and lowercase, while in Linux it is distinguished by uppercase and lowercase

3 Creating a dedicated user for the operational database

Syntax rules:

Create a new user and give it permission to operate on the database grant all privileges the on database name. * To [email protected] identified by password

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

This gives all the permissions (all privileges) that users of the database from the local connection user can manipulate on all objects in the home database.

Permissions are a measure of what the user can do with the database, using the Create (creating) SELECT (Retrieve) update (UPDATE) Delete (delete) permissions.

Other than that. [test.*] section, detailed 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. Ability to use the Select command to view the databases used today

Today, the database that is used is displayed in SELECT databases ();

Mysql> Select Database ();

MySQL Foundation-Basic database 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.