Mysql Data目录和 Binlog 目录 搬迁的方法
刚开始安装时使用了默认目录,使用一段时间,数据慢慢变在,发现当前设置的目录空间不够时,就要搬迁数据到另一个目录了
如果全过程使用的是Mysql用户,应该可以正常启动。如果用的ROOT用户,可能不能正常启动,原因是新建的目录权限不对。
可能会这样的错误提示:
/usr/local/mysql/libexec/mysqld: File ‘/home/mysql/mysqllog/binlog/mysql-bin.index' not found (Errcode: 2)
1. stop mysql service 一定要先停止,非常重要。
# /etc/init.d/mysqld stop
2. 修改Mysql配置 My.cnf:
#datadir = /usr/local/mysql/var
#log-bin = /usr/local/mysql/var/binlog/mysql-bin
datadir = /home/mysql/mysqldata
log-bin = /home/mysql/mysqllog/binlog/mysql-bin
3. copy mysql data
# cp -rf /usr/local/mysql/var/* /home/mysql/mysqldata/
4. start mysql service
# /etc/init.d/mysqld start
如果全过程使用的是Mysql用户,应该可以正常启动。
如果用的ROOT用户,可能不能正常启动,原因是新建的目录权限不对。
使用下面命令修改就可以了:
# chown mysql:mysql /home/mysql -R
如果使用了Innodb注意下面修改:
innodb_data_home_dir = /home/mysql/mysqldata/
innodb_log_group_home_dir = /home/mysql/mysqldata/

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

1. Binlog Binlog is used to record write operations (excluding queries) information performed by the database and save it on the disk in binary form. Binlog is the logical log of mysql and is recorded by the server layer. Mysql databases using any storage engine will record binlog logs. Logical log: can be simply understood as a sql statement; physical log: data in MySQL is stored in the data page, and the physical log records changes on the data page; insert the code piece here and the binlog is written by appending Input, you can set the size of each binlog file through the max_binlog_size parameter. When the file size reaches the given value

Preface There are six types of log files in MySQL, namely: redo log (redolog), rollback log (undolog), binary log (binlog), error log (errorlog), slow query log (slowquerylog), general query log (generallog) ), relay log (relaylog). 1. What is redolog? Redolog, also known as redo log file, is used to record changes in transaction operations. It records the value after data modification. It will be recorded regardless of whether the transaction is submitted or not. Redolog files can come in handy when instances and media fail (mediafailure), such as database power outage, Inn

1. Introduction to Binlog log Binlog is the abbreviation of Binarylog, that is, binary log. Binlog has three main functions: converting random IO into sequential IO during persistence, master-slave replication and data recovery. This article focuses on issues related to master-slave replication. The Binlog log consists of an index file and many log files. Each log file consists of a magic number and an event. Each log file ends with a Rotate type event. For each event, it can be divided into two parts: event header and event body: The structure of the event header is as follows: The structure of the event body includes two parts: fixed size and variable size. For the format of Binlog log, you can have a simple understanding. Interested students can go deeper.

1. Source of the problem When analyzing performance problems, slow queries and binlog slow transactions are commonly used methods. Recently, I was analyzing a slow query and found that it contained a large number of commit statements that were slow, but the matching could not be completed when analyzing the binlog slow transactions. For example, there may be 1,000 commit statements during this period, but there may be only 100 slow transactions. This is too big a difference, so why does this phenomenon occur? 2. The respective determination methods for slow transactions are usually as follows for an explicitly submitted (insert) transaction: GTID_LOG_EVENT and XID_EVENT are the time when the command ‘COMMIT’ is initiated.

Regarding the MySQL binary log (binlog), we all know that the binary log (binlog) is very important, especially when you need point-to-point disaster recovery, so we need to back it up. Regarding the backup of binary log (binlog), you can first switch the binlog based on the flushlogs method, and then copy & compress it to other storage on the remote server or local server, such as mounted NAS storage. You can also use mysqlbinlog to backup the binlog. Implement local backup or remote backup of MySQL binary log (binlog). Finally, the MySQL binary log (binlog

1.Introduction to kingbus 1.1What is kingbus? Kingbus is a distributed MySQL binlog storage system based on the raft strong consistency protocol. It can act as a MySQLSlave to synchronize binlog from the real Master and store it in a distributed cluster. At the same time, it also acts as a MySQLMaster to synchronize the binlog in the cluster to other slaves. kingbus has the following features: It is compatible with the MySQL replication protocol, synchronizes the binlog on the master through Gtid, and supports the slave to pull the binlog from kingbus through Gtid.

The data folder contains system and program data, such as software settings and installation packages. Each folder in the Data folder represents a different type of data storage folder, regardless of whether the Data file refers to the file name Data or the extension. Named data, they are all data files customized by the system or program. Data is a backup file for data storage. Generally, it can be opened with meidaplayer, notepad or word.

The solution to the garbled mysql load data: 1. Find the SQL statement with garbled characters; 2. Modify the statement to "LOAD DATA LOCAL INFILE "employee.txt" INTO TABLE EMPLOYEE character set utf8;".
