Basic MySQL-basic database operations

Source: Internet
Author: User

Basic MySQL-basic database operations

1. Delete the database drop database name;

Mysql> drop database test;

Delete database mode

2. create DATABASE name;

Mysql> create database test;

In Windows and Linux, database names and table names are processed differently. In Windows, database names and table names are case-insensitive, while in Linux, database names are case-sensitive.

3. Create a dedicated user for database operations

Syntax Rules:

Create a new user and GRANT the database operation permission grant all privileges on database name. * TO username @ localhost identified by password

Mysql> grant all privileges on test * TO user $ localhost identified by '20140901 ';

This grants the user who connects to the database from the local database ALL the permissions (all privileges) to operate on ALL objects in the home database ). Permissions are used to measure the operations that a user can perform on the database. CREATE (CREATE) SELECT (Search) UPDATE (UPDATE) DELETE (DELETE) and other permissions are used. In addition, in the [test. *] section, perform operations on specific tables in the database.

4. log on to the database as a user

Mysql>-u user-p

Enter password :******

5. database used

USE the specified database USE Database Name

Mysql> use home;

6. If you forget the specified database when using the MySQL monitor, you can use the SELECT command to view the currently used database.

Displays the currently used database select database ();

Mysql> select database ();

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.