"MySQL" MySQL add change to delete basic command and backup operation

Source: Internet
Author: User

Experimental environment

Virtualized devices: Esxi6.0
System: REDHAT7
Database: MariaDB #操作与mysql相同
The 18th chapter uses the MARIADB database management system.
Learn 4 kinds of backup MySQL database (basic backup aspect no problem)

First, the initialization of the MARIADB service
yum install mariadb mariadb-server -y #在Redhat7中,用yum安装mysql默认安装的就是mariadbsystemctl start mariadbsystemctl enable mariadbmysql_secure_installation #对数据库进行初始化操作,根据提示选择就好了,root密码初始设置为空,直接回车就好了。firewall-cmd --permanent --add -service=mysqlfirewall-cmd --reload
Second, the database of additional changes to delete the basic operations 1, check
mysql -u root -p #进入数据库
SHOW database; #查看数据库use mysql; #进入数据表mysqlSELECT * FROM mysql #查看mysql表里的信息(加WHERE 可跟限制条件)SELECT name,price FROM mybook; #查看mybook表里name和price两项SELECT * FROM mybook WHERE price>75;DESCRIBE mysql; #描述表单
2, increase
CREATE DATABASE linuxprobe; #创建数据库linuxprobeCREATE TABLE mybook (name char(15),proce int,pages int); #创建数据包mybookINSERT INTO mybook(name,price,pages) VALUES(‘linuxprobe‘,‘60‘,‘518‘); #在数据表mybook添加信息
3, change
UPDATE mybook SET price=55; #修改mybook里price为55
4. By deleting
DELETE FROM mybook; #删除mybook数据表所有数据DROP DATABASE linuxprobe; #删除数据库linuxprobeDROP TABLE mybook; #删除数据表mybook
Third, database backup and recovery 1, database backup
mysqldump -u root -p linuxprobe > /root/linuxprobeDB.dump #备份linuxprobe数据库
2, the recovery of the database
mysql -u root -p linuxprobe < /root/linuxprobeDB.dump #恢复linuxprobe数据库

"MySQL" MySQL add change to delete basic command and backup operation

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.