In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "CentOS 7 configuration and installation of MySQL tutorial", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and study the "CentOS 7 configuration and installation of MySQL tutorial" bar!
CentOS 7 configuration-install MySQL1. Get MySQL source https://dev.mysql.com/downloads/repo/yum/2. Download the MySQL source wget https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm3. Install the MySQL source yum-y install mysql80-community-release-el7-3.noarch.rpm4. Install MySQLyum-y install mysql-community-server5. Set up Boot Boot # enable systemctl enable mysqld# disable systemctl disable mysqld# reload configuration systemctl daemon-reload6. Start MySQL#, start MySQLsystemctl start mysqld.service#, stop MySQLsystemctl stop mysqld.service# to view the running status of systemctl status mysqld.service7. Open firewall port # enable port 3306 firewall-cmd-- zone=public-- add-port=3306/tcp-- permanent# restart firewall firewall-cmd-- reload8. Get the initial password grep "password" / var/log/mysqld.log9. Set remote access authorization
Log in to MySQL
Mysql-u root-p
Modify configuration
ALTER user 'root'@'localhost' IDENTIFIED BY' *'; USE mysql;UPDATE user SET host='%' WHERE user='root';FLUSH PRIVILEGES;10. Set the backup script #! / bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbinexport PATH# database user name dbuser='root'# database password dbpasswd='root'# needs to back up the database Multiple databases use spaces to separate dbname='db_name'# backup time backtime= `date +% Y% m% d% H% M% S` # Log backup path logpath='/home/database_backup/db_name'# data backup path datapath='/home/database_backup/db_name'# Log recording header echo "[`date'+% Y/%m/%d% HAV% MHD% S`] start backup." > > ${ Logpath} / backup.log# official backup database for table in $dbname Dosource= `mysqldump-u ${dbuser}-p$ {dbpasswd} ${table} > ${logpath} / ${backtime} .sql`2 > > ${logpath} / backup.log;# backup successfully the following operations if ["$?" = = 0] Thencd $datapath# to save hard disk space, compress the database tar jcf ${table} _ {backtime} .tar.bz2 ${backtime} .sql > / dev/null# to delete the original file, leaving only the compressed file rm-f ${datapath} / ${backtime} .sql # deleted seven days before the backup, that is, only the backup find $datapath-name "* .tar.bz2"-type f-mtime + 7-exec rm-rf {}\ > / dev/null 2 > & 1echo "[`date'+% Y/%m/%d% HV% MV% S'`] backup succeeds." > > ${logpath} / backup.logelse# backup fails, then perform the following operation: echo "[`date'+% Y/%m/%d% HV% MVR% S'`] backup failed." > > ${logpath} / backup.logfidone11. Set scheduled task crontab# start crontabsystemctl start crond# stop crontabsystemctl stop crond# view running status systemctl status crond
Edit Task Profil
# Open the configuration file crontab-e# add tasks: execute script 3023 * sh / home/database_backup/db_name/backup.sh# at 23:30 every day to view scheduled tasks crontab-l Note:
Install WGET:
Yum install-y wget
Install bzip2:
Yum install-y bzip2 thank you for reading, the above is the "CentOS 7 configuration and installation of MySQL tutorials" content, after the study of this article, I believe you have a deeper understanding of CentOS 7 configuration and installation of MySQL tutorials, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.