Mysql common maintenance

Source: Internet
Author: User
1. System Management mysql-h host address-u user name-p connection MYSQL (in mysqlbin) mysqladmin-u user name-p old password New password Change password (in mysqlbin) grantselect [insert] [, update] [, delete] on database. * to username @ localhost (%, indicating any host) identifiedby Password

1. System Management mysql-h host address-u user name-p connect to MYSQL (in mysql/bin) mysqladmin-u username-p old password New password Change password (in mysql/bin) grant select [insert] [, update] [, delete] on database. * to username @ localhost (%, indicating any host) identifiedby Password

1. System Management
Mysql-h host address-u username-p
Connect to MYSQL (in mysql/bin)

Mysqladmin-u username-p old password New password
Change Password (in mysql/bin)
Grant select [insert] [, update] [, delete] on database. * to username @ localhost ("%", indicating any host) identifiedby "password"
Add users
Mysqldump-u root-p -- opt Database Name> Backup File Name
Back up the database (in mysql/bin)


Select version ()
Query version number

Select current_date
Query current date

Show databases
Show database list

Show tables

Describe Table Name displays the structure of the data table

Use database Name
Databases Used

Create database Name
Create a database

Create table Name
Create a table in the database

Command for backing up MySQL database

Mysqldump-hhostname-uusername-ppassword databasename> backupfile. SQL

Back up multiple MySQL databases at the same time

Mysqldump-hhostname-uusername-ppassword-databases databasename1 databasename2 databasename3> multibackupfile. SQL

Directly compress and back up the MySQL database

Mysqldump-hhostname-uusername-ppassword databasename | gzip> backupfile. SQL .gz

Command for restoring MySQL database

Mysql-hhostname-uusername-ppassword databasename <backupfile. SQL

Restore a compressed MySQL database

Gunzip <backupfile. SQL .gz | mysql-uusername-ppassword databasename

@ Echo off
"C: \ Program Files \ MySQL Server 5.1 \ bin \ mysqldump.exe"-uroot-plove2you bugfree2> E: \ backup \ bugfree. SQL

E:
Cd E: \ backup
Rar a % date :~ 10,14% % date :~ 4,2% % date :~ 7,22.16.rar bugfree. SQL
Rd/s/q E: \ backup \ *. SQL
Net use I: \ 192.168.1.8 \ backup "w7! Lz0 # A "/user:" xsunt_008"
Move *. rar I: \ bugfree
Exit

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.