1 Check mysql installation
service mysql start or / bin / systemctl Start mysql.serviice
2 mounted
yum -y install mysql
installation-Service-musql
wget http://dev.mysql.com/get/mysql-community-release-el7-5 .noarch.rpm
RPM -ivh mysql-Community-Release-el7-5.noarch.rpm
yum the install mysql-Community Server-
mounted expanding mysql
yum the install mysql -Y-Connector-ODBC mysql-devel-DBD-mysql libdbi
. 3 start
service mysqld restart
View -ef PS | grep MySQL
4 configuration
mysql_secure_installation password
<------ ------ recommendations directly enter!!>
whether to delete the anonymous user, proposed to delete the production environment, it can directly enter
remove anonymous users? [Y / n]
whether to disable root remote login, select Y / n and press Enter to suit your needs, the proposed ban
Disallow root login remotely? [Y / n]
whether to delete the test database, enter directly
Remove test database and access to it? [Y / n]
whether to reload the privilege tables directly enter
Reload privilege tables now? [Y / n]
5 connect to the database
(1) MySQL -p127.0.0.1-uroot--proot
(2) create a database connection input /connect/m.sh script
#! / bin / SH
MySQL -p127.0.0.1-uroot--proot
(3) execution
/connect/m.sh SH
. 6 to create the database character set
Create Database IF Not EXISTS TEST03 = SET default Character 'UTF8';
Create User Table (
ID int (. 11) Not null AUTO_INCREMENT,
name char (50) Not null default '' comment 'name',
Mobile char (. 11) Not null default '' comment 'phone',
Primary Key (ID),
Key Mobile (Mobile)
) Engine = InnoDB AUTO_INCREMENT =. 1 default charset = UTF8 Comment = 'user table';
7 scheduled backup database
(1) mounting the mysqldump
yum the install -Y-Holland mysqldump.noarch
(2) the mysqldump -uroot--ppass --databases database 1 database 2> xxx.sql
the mysqldump -uroot--proot --databases Test> test.sql
(3) the timing of scheduled tasks to perform database backups
Creating /connect/backup.sh input
#!/bin/bash
mysqldump -uroot -proot --databases test > /connect/test.sql
Scheduled Tasks:
* / 1 * * * * /connect/backup.sh once per minute backup.sh
Can be seen next connect folder appears test.sql
One of the possible reasons for the failure to perform scheduled tasks are: backup.sh not authorized to perform
Solve: chmod u + x backup.sh
important! important! important!
The foregoing is a learning process notes for reference purposes only.