Install MySQL and simple operation under Linux

Source: Internet
Author: User

1. go to the Linux System mount CD (or download mysql-server MysqL), configure the yum Source

2. yum install-y mysql-server MySQL

3. Service mysqld start

4. Log in to the database MySQL [-u username] [-h host] [-p[password]] [dbname]

5. Change Password root User:usr/bin/mysqladmin-u root password ' new-password '

6. Database directory /var/lib/mysql/

7. configuration file /usr/share/mysql mysql.server command and configuration file

8. Related command /usr/bin (mysqladmin mysqldump , etc. )

9. startup script /etc/rc.d/init.d/ (startup script file mysql directory)

Display library show databases;

one. show tables in the database name of use database; show Tables;

showing the structure of the database table describe table name;

displaying records in a table select *  from table name;

Build database name of database database;

Building a table

1) Use library name;

2)create table table name (field settings list);

CREATE TABLE guowq (ID int (3) auto_increment NOT null primary key, XM char (8), XB char (2), CSNY date);

Add record: INSERT INTOguowq values (' ', ' Guo Wenqiang , ' male , ' 1990-08-16 ');

modified record:update name set csny= ' 1971-01-10 ' where xm= ' Guo Wenqiang ';

Delete library and delete table: Drop database name; drop table name;

add Users: GRANT SELECT ON  database .* TO  @ login host   identified by  " password " ;

add a user user password is 123 Span style= "font-family: ' The song Body '; > so that he can log on on any host and have access to queries, insertions, modifications, and deletions to all databases. First for root user-attached mysql

Grant select,insert,update,delect on *.*to [email protected] " % " identified by " 123 " ;

. Backup and recovery:

1) Backup

Mysqldump-u root-p--opt library name > Library name . bak;

2) Recovery

Mysql-u root-p Library name . bak < library name ;

This article is from the "Menlong" blog, make sure to keep this source http://7616247.blog.51cto.com/7606247/1653815

Install MySQL and simple operation under Linux

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.