Linux MySQL Base operation

Source: Internet
Author: User
Tags mysql backup

Command #查看版本MySQL--version #进入mysql CommandMysql-u root-pmysql-u [email protected] (case without password) #创建数据库Create DATABASE [dataname] #删除数据库drop database [dataname] #查看数据库show databases; #进入具体数据库use [dataname] #查看数据库表show tables; #删除表drop table [tablename] #查看具体表的结构desc [tablename] #查找数据select * FROM tablename #插入数据insert Insto [TableName] (103, ' test ‘); #修改数据update [TableName] set name= "and id=103 #删除数据delete [tablename] where name= ' #添加索引 ALTER TABLE [tablename] Add fulltext index ([ColumnName]);   #查看索引 Show index from [tablename] \gStart switch: Service MySQL {start|stop|status|restart|condrestart|try-restart|reload|force-reload} Repair Table View table Status Show Table status like ' tablename ' \g;Inspection table Check Table tablenameRepair table Repair Table TableName Compression Table View data File Locations show global variables like '%datadir% '; Compress Files Myisampack *. MYD #mysql Backup Cold Backup BackupStop MySQL service, restart MySQL service in Operation Basic backup MySQL database, backup restart after production Binlog Logical RecoveryMysql-u Root-p [Databasename]<[backname].sql Logical BackupExport entire Database mysqldump-u root-p [DatabaseName]-F >[backname].sql export a table mysqldump-u root-p [DatabaseName] [tablename]>[ Table].sql Export Database Structure mysqldump-u root-p-D--add-drop-table [Databasename]>[database].sql- D No data--add-drop-table add a drop table before each create statement

Linux MySQL Base operation

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.