MySQL RPM package after installation modify Data directory
1. Stop MySQL Data service
/etc/init.d/mysqld stop
2. Specify permissions for the created data directory
Chmod-r 777/home/mysql/database/*
Chown-r mysql.mysql/home/mysql/database/*
3. Copy all the contents of the default data directory to the current directory (can also be completed before the second step)
Cp-r/var/lib/mysql/*/home/mysql/database/
4. Modify the configuration file
Vim/etc/my.cnf
[MySQL]
Socket=/home/mysql/database/mysql.sock//Login Database secure Signature Set directory
[Mysqld]
Datadir=/home/mysql/database//Data Catalog
port=3307//can modify the default 3306 port number
Symbolic-links=0
Log-error=/home/mysql/log/mysqld.log//Error log directory
Pid-file=/var/run/mysqld/mysqld.pid
Log_bin = Mysql-bin
server_id = 1
Log_bin_trust_function_creators = ON//When creating functions and stored procedures, resolves an issue that was synchronized from the library
Event_scheduler=on
Max_allowed_packet = 200M
Binlog_format=mixed//Mixed mode save binary log
Lower_case_table_names=1
Sql_mode=strict_trans_tables,no_zero_in_date,no_zero_date,error_for_division_by_zero,no_auto_create_user,no_ Engine_substitutio
5. Restart MySQL
/etc/init.d/mysqld restart
6. Login
Log on Locally
mysql-u root [email protected]
Telnet
mysql-uroot [email protected]-H 192.168.31.64-p3306
This article is from the "92868888" blog, please be sure to keep this source http://92868888.blog.51cto.com/12381417/1921161
MySQL RPM package after installation modify Data directory