Notes on MySQL-1

Source: Internet
Author: User

MySQL is the same under Windows and Linux commands, so the tutorial in Windows environment is as capable as running under Linux.

Enter the database

Mysql-u account name-p password

Exit database

Exit

Database server, database, table, record relationship

    1. There are multiple databases in a MSYQL server

    2. There are multiple tables in a database

    3. There are multiple records in a table


Object vs. Relational mapping

    1. Class-Table

    2. Properties-Fields

    3. Objects-Records


Show databases: Querying all databases in the MySQL server

Use database name: Select a database

Show tables: Querying all tables in the database


Create the database, if it is available directly, if not, create

Create DB if not EXISTS database name

Create a database that uses the UTF-8 character set

Create database if not exists DB name character Set UTF8

Note: Creating a database is by default using the UTF-8 character set.

The UTF8 character set in the database is the UTF-8 character set, which is different.


Modifying the character set of an existing database

Alter DATABAE database name character Set modified character set

NOTE: Alter is a variety of modifications to an existing database, followed by a certain statement.


Deletes an existing database and does not operate if it does not exist

Drop DB if exists database name

To view the definition information for a database that has been created

Show CREATE DATABASE name

Delete a database that already exists

Drop DB if exists database name

Backing Up the database

Mysqldump-u Account-P database name > path + file name

Recovering a Database

Source Path + file name (in MySQL environment)

Note: The backup referred to here refers to copying the contents of the database into the corresponding SQL file, restoring the contents of the SQL file to a table in the database. When recovering, the database is created and used, and then restored through Sorce because there is only table information in the SQL file and no database information.


Notes on MySQL-1

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.