Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Tutorials on operating MySQL

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the operation of MySQL tutorials, the contents of the articles are carefully selected and edited by the author, with a certain pertinence, for everyone's reference significance is still relatively great, the following with the author to understand the operation of MySQL tutorials bar.

# Import and restore database

Mysqldump-uroot-p zabbix > / root/zabbix.sql

Restore database

Mysql-uroot-p zabbix

< /root/zabbix.sql #清理binlog mysql -uroot -p help purge PURGE MASTER LOGS BEFORE '2003-04-02 22:46:26'; #更改 root密码 service mysql stop echo skip-grant-tables >

/ etc/my.conf

Service mysql start

Mysql

USR root

UPDATE user SET Password = password ('1q2w3e4r5t') WHERE User =' root'

Flush privileges

Quit

Vi / etc/my.conf

# skip-grant-tables

Wq

# canceling password complexity

SHOW VARIABLES LIKE 'vali%'; # to see if password complexity is enabled

[mysqld]

Validate_password=off

# install Precona

Yum-y remove mysql-libs

Yum install cronie cronie-anacron crontabs redhat-lsb-core sysstat

# yum-y install mysql-client mysql-server

# mysql config

# service mysql start

# chkconfig mysql on

Yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm

Yum install Percona-Server-shared-56 Percona-Server-client-56 Percona-Server-server-56

Service mysqld start

Chkconfig mysqld on # set boot up

MySQL-v # detects MySQL version

# mysqladmin-u root passwd root sets the database password for root

= master-slave copy = =

# Open Master database my.conf file

Vi / etc/my.conf

Server_id=1

Binlog_format=ROW

Binlog_row_p_w_picpath=minimal

# set the database to be backed up

Binlog-do-db=db_01

Binlog-do-db=db_02

Expire-logs-days=7 # keep a 7-day binary log

Binlog_format=MIXED # set binlog format to MIXED

Log-bin = mysql-bin # enable MYSQL binary log

Wq

Service mysql restart

Mysql # enter mysql

Use ebdb_trans; # using the ebdb_trans database

Grant replication slave on *. * to 'backup'@'192.168.0.11'identified by' your password; # set slave IP and login permissions

Flush privileges

Flush tables with read lock

Reset master

Show master status\ G; # View file, position and record the value

Exit

# backup master database to slave

Mysqldump ebdb_trans > / root/ebdb_trans.sql

# switch to slave and restore the database

Mysql ebdb_trans < / root/ebdb_trans

Vi my.conf

Server-id=2

Replication-do-db=ebdb_trans # name of the database to be replicated

Slave-skip-errors=1032,1062,126,1114,1146,1048,1396 # automatically skips the error code to prevent the replication error from being interrupted

Wq

Mysql # specify the main library information

Reset slave

Change master to master_host='192.168.0.8',master_user='backup',master_password='28270033',master_log_file='mysql-bin.000001',master_log_pos=120

Start slave; # launch slave

Show slave status\ G; # check the slave library status (Slave_IO_Running: Yes Slave_SQL_Running: Yes) file

=

Frequently asked questions:

1. Slave_IO_Running:no

(1 check whether my.conf-server-id is the same as master

(2 check whether server_UUID is the same as master, and modify / var/lib/mysql/auto.conf if the same

Enter mysql

Show variables like'% server_uuid%'

2. Slave_SQL_Running: no

Stop the slave library, reassign the master library information, and finally start slave

After reading the above tutorials on the operation of MySQL, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report