MySQL RPM package after installation modify Data directory

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.