Mysql Data目录和 Binlog 目录 搬迁的方法

2013-12-04  来源:本站原创  分类:Mysql  人气:1 

刚开始安装时使用了默认目录,使用一段时间,数据慢慢变在,发现当前设置的目录空间不够时,就要搬迁数据到另一个目录了

如果全过程使用的是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/

相关文章
  • Mysql Data目录和 Binlog 目录 搬迁的方法 2013-12-04

    刚开始安装时使用了默认目录,使用一段时间,数据慢慢变在,发现当前设置的目录空间不够时,就要搬迁数据到另一个目录了 如果全过程使用的是Mysql用户,应该可以正常启动. 如果用的ROOT用户,可能不能正常启动,原因是新建的目录权限不对. 可能会这样的错误提示: /usr/local/mysql/libexec/mysqld: File '/home/mysql/mysqllog/binlog/mysql-bin.index' not found (Errcode: 2) 1. stop mysql

  • MySQL的几个重要目录[linux] 2011-07-02

    MySQL的几个重要目录 MySQL安装完成后不象SQL Server默认安装在一个目录,它的数据库文件.配置文件和命令文件分别在不同的目录,了解这些目录非常重要,尤其对于Linux的初学者,因为Linux本身的目录结构就比较复杂,如果搞不清楚MySQL的安装目录那就无从谈起深入学习. 下面就介绍一下这几个目录. 1.数据库目录 /var/lib/mysql/ 2.配置文件 /usr/share/mysql(mysql.server命令及配置文件) 3.相关命令 /usr/bin(mysqlad

  • mysql data storage engine InnoDB and MyISAM, according to the advantages and differences between 2010-11-03

    MyISAM: This is the default type, which is based on the traditional type ISAM, ISAM is the Indexed Sequential Access Method (indexed sequential access method) the abbreviation, it is the storage of records and documents of the standard method. Compar

  • mysql data InnoDB and MyISAM storage engine, according to the strengths and differences 2010-11-03

    MyISAM: This is the default type, which is based on the type of traditional ISAM, ISAM is the Indexed Sequential Access Method (indexed sequential access method) of the abbreviation, it is the storage of records and documents of the standard method c

  • Creating a MySQL data source using WebSphere Application Server 2010-03-29

    DATABASE CONNECTIVITY Recently, Senior Technical Editor Dan Velasco wrote an article on how to connect to the popular open source database MySQL from WebSphere Studio Application Developer (see http://www.webspherepower.com/issues/issue200310/0000111

  • java mysql data type control 2010-04-16

    MySql data types and Java data type mapping table Type name and display the length type JDBC type database type JAVA index (int) Description VARCHAR L + N VARCHAR java.lang.String 12 CHAR N CHAR java.lang.String 1 BLOB L + N BLOB java.lang.byte [] -4

  • MySQL Data Type Analysis 2010-04-23

    We want the real world in a variety of information into something the computer can understand, these converted information data is formed. For example, a person's birth date is "May 23, 1987", his height is 170 cm, and so on. Data include not on

  • ubuntu9.10 replace Mysql data directory, mysql server not start 2010-05-01

    ubuntu9.10 replace Mysql data directory, mysql server not start Mysql Data directory change, mysql server not start. Solution record is as follows First of all, to see how we modify the mysql data directory Build a new database directory mkdir / medi

  • mysql data folder overwrite data Notes 2010-05-23

    mysql data folder overwrite the data when the attention of: Cover ib_logfile0 and ib_logfile1 lead service can not start and report to the 1067 error. Therefore, these two files should not be covered, but they can not exist. In the service will start

  • MySql data types and Java data type mapping table 2010-05-26

    java mysql data type control Type name Show Length Database Type JAVA type JDBC type index (int) Description VARCHAR L + N VARCHAR java.lang.String 12 CHAR N CHAR java.lang.String 1 BLOB L + N BLOB java.lang.byte [] -4 TEXT 65535 VARCHAR java.lang.St

  • [Change] MySQL data table under the chaotic character encoding processing and a number of commonly used when dealing with character encoding order order 2010-05-27

    Because they do not know when because we have a database with the invincible super rogue features: data table encoding is Latin1-swXXXX something. The Chinese kept inside is forced to utf8 php saved in them. Thus, out of a variety of messy eccentric

  • MySQL data types and analysis of building a database strategy 2010-06-03

    This article mainly characterized yes MySQL data types and Jian Library Celue the Xiangxijiexi, we are all aware that they do not charge Zai is a large database Kongjianhuozhe e-commerce site design table its reasonable structure, full use of space i

  • Linux, MySQL data import 2010-06-09

    Linux, MySQL Data Import: load command with Data Import load data infile 'D: / JPSexContentMark/outputfile/url_log2010-05-04.log' into table mytest fields terminated by '\ t' enclosed by '"' ; Which require single quotation marks filepath table table

  • (MySQL notes) MySQL data types 2010-06-11

    (MySQL notes) MySQL data types On a: (MySQL Notes) set up MySQL database system MySQL refers to the direct volume is a direct value, is a fixed, will not change the value. The amount of data types directly into such categories: numerical, character,

  • MySQL data segmentation and integration solutions 2010-07-08

    Segmentation of data through a database can significantly improve system scalability. However, data in the database through the vertical and (or) the level of segmentation is stored in different database hosts, and application systems biggest problem

  • mysql data types commonly used in the length of summary 2010-07-12

    [/ Align] create table in mysql, varchar type must specify the length, int type can not specify the length. Of course, the user interface in mysql create table (do not use sql statements to create the table), if the specified length, it will for you

  • MYSQL data type integration 2010-07-17

    About MySQL data types The length of which in bytes Name Length Usage TINYINT (M) BIT, BOOL, BOOLEAN 1 If unsigned, you can store a number from 0 to 255; Otherwise, you can store the number from -128 to 127. SMALLINT (M) 2 If unsigned, you can store

  • Common MySQL data types 2010-08-02

    The most common MySQL data types VARCHAR, DECIMAL, DATE, INT, TEXT, and TIMESTAMP. The first one: VARCHAR is normally used up to 255 characters in length string variable. If you want to store and process alphanumeric data type, this data type is most

  • time backup mysql data 2010-08-06

    1.mkdir database_bak 2.vi / usr / sbin / bak.sh rq = 'date +% Y% m% d' tar zcvf datbase_bak / mysql $ rq.tar.gz / usr / local / mysql / data mysqldump - all-databases-u username-ppassword> database_bak / $ rq.sql 3.chmod + X / usr / sbin / bak.sh 4.v

  • MySQL Data Recovery Process 2010-09-08

    From another machine on the MySQL database mysql folder copied to the local machine, the purpose of restoring the local machine to access and manipulate the data. After the operation the following several conditions. 1. In the local reloading MySQL (