Mysql Quick Start 1, mysql Quick Start

Source: Internet
Author: User

Mysql Quick Start 1, mysql Quick Start
Mysql Introduction

1. What is a database?

A Database is a warehouse that organizes, stores, and manages data according to the data structure. It was created more than 60 years ago. With the development of information technology and the market, especially after 1990s, data management is no longer just about data storage and management, but also the various data management methods required by users. There are many types of databases. From the simplest storage of tables with various types of data to the large database systems capable of storing massive data, they have been widely used in various aspects.

Mainstream databases include sqlserver, mysql, Oracle, SQLite, Access, and ms SQL Server. This article mainly describes mysql

2. What is database management?

  • A. Save the data to a file or memory
  • B. receive specific commands and perform operations on the files

PS: if you have the above management system, you do not need to create files and folders on your own, but directly pass the command to the above software for file operations, they are collectively referred to as Database Management systems (DBMS, Database Management System)

Install mysql

MySQL is an open-source Relational Database Management System (RDBMS). the MySQL database system uses the most common database management language-Structured Query Language (SQL) for database management. In terms of WEB applications, MySQL is one of the best applications of RDBMS (Relational Database Management System.

Mysql must meet the following conditions:

  • A. Install MySQL Server
  • B. Install the MySQL client
  • B. [client] connect to [server]
  • C. [client] sends a command to the [server MySQL] service to receive the command and execute the corresponding operation (add, delete, modify, query, etc)

1 ,:http://dev.mysql.com/downloads/mysql/

2. Installation

  • Windows Installation see http://www.cnblogs.com/lonelywolfmoutain/p/4547115.html
  • Linux installation: http://www.cnblogs.com/chenjunbiao/archive/2011/01/24/1940256.html

Note: The above two links have a complete installation method. The installation method of the supervisor is also based on its installation. After installation, mysql. server start starts the mysql service.

Mysql operations

1. Connect to the database

Mysql-u user-p example: mysql-u root-p

Common Errors are as follows:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2), it means that the MySQL server daemon (Unix) or service (Windows) is not running.

Exit connection:

QUIT or Ctrl + D

2. view the database, create a database, and use the database to view the database: show databases;

Default Database: mysql-user permission-related data test-used for user test data information_schema-MySQL architecture-related data to create a database:
Create database db1 default charset utf8 COLLATE utf8_general_ci; # utf8 Encoding
Create database db1 default character set gbk COLLATE gbk_chinese_ci; # gbk Encoding
Use Database: use db1;

Display all TABLES in the currently used database: show tables;

Iii. User Management

Create user 'username' @ 'IP address' identified by 'Password'; delete user drop user 'username' @ 'IP address '; modify the user rename user 'username' @ 'IP address'; to 'new username' @ 'IP address ';; change password set Password for 'username' @ 'IP address '= password ('new password ')

Note: user permission-related data is stored in the user table of the mysql database, so you can directly operate on it (not recommended)

Iv. permission management

Mysql has the following restrictions on permissions:

All privileges all permissions except grant select only query permissions select, insert query and insert permissions... usage has no access permission. alter use alter table alter routine use alter procedure and drop procedure create use create table create routine use create procedure create temporary tables use create temporary tables create user use create user, drop user rename user and revoke all privileges create view use create view delete use delete drop use drop table execute use call and stored procedure file use select into outfile and load data infile grant option use grant and revoke index use index insert USE insert lock tables use lock table process use show full processlist select use select show databases use show databases show view use show view update use update reload use flush shutdown use mysqladmin shutdown (close MySQL) super

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.