How to change the MySQL Data File Path

Source: Internet
Author: User

How can I change the MySQL data file path? Many people may have such questions. The following describes how to change the path of the MySQL data file. Before that,

Let's take a look at the path of the current MySQL Data File in the database:

 
 
  1. mysql> show variables like '%dir%';  
  2. +----------------------------+----------------------------+  
  3. | Variable_name | Value |  
  4. +----------------------------+----------------------------+  
  5. | basedir | / |   
  6. | character_sets_dir | /usr/share/mysql/charsets/ |   
  7. | datadir | /data/mysql/ |   
  8. | innodb_data_home_dir | |   
  9. | innodb_log_arch_dir | |   
  10. | innodb_log_group_home_dir | ./ |   
  11. | innodb_max_dirty_pages_pct | 90 |   
  12. | slave_load_tmpdir | /tmp/ |   
  13. | tmpdir | /tmp/ |   
  14. +----------------------------+----------------------------+ 

If you think the MySQL data file path is correct, you do not need to modify it. If you are not satisfied, you can modify it.

1: service mysql stop
Close Database

2: vi/etc/rc. d/init. d/mysql

3: Change datadir =/var/lib/mysql to what you want. OK.

4: service mysql start

Modify Table Structure in MySQL -- add and delete Fields

Seven common MySQL command lines

Use the MySQL command line to change the password

Optimize MySQL statement instances through Indexes

Cancel MySQL user permissions

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.