• notice
  • Congratulations on the launch of the Sought Tech site

Method for modifying the mysql Data file clip position under Windows

Follow the normal steps to install mysql, and find that the default directory of datadir is

The code is as follows:
C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data

Originally, the capacity of the C drive is not much, of course it can’t be placed in this~~ So follow the steps on the Internet, modify the my.ini file, and then restart the service in the “service”, terrible thing It happened, and the error "The local computer could not start the Mysql service" appeared.I was so distressed that I had to uninstall and reinstall.The problem was still the same.I kept Baidu and Google and finally solved it.The summary is as follows.
1.Log in to the mysql monitor command:
The code is as follows:

cmd >> mysql-u root-p     //then Enter the password

2.To view the storage location of the database on the disk:
The code is as follows:
mysql > show variables like'%datadir%';


Go to this directory under the C drive to view (hidden folder), as expected, the data exists here, and each database corresponds to A folder, my purpose is to change this address to the data folder under the mysql installation directory of the E disk.You must be careful step by step, otherwise it is easy to make mistakes.
3.Modify the data storage location
1.Copy all the folders under C:\``````````\data above to the target location E:\ ````\data (don't delete those data files under C drive, so as to avoid errors when configuring later);

2.Open the my.ini file in the installation directory and find this line:    datadir="C:/ProgramData/MySQL/MySQL Server 5.5/data/"  Amend to: datadir="E:\MySQL\data", pay special attention to "\" instead of "/", otherwise it will not succeed (I don't know why!!!)
3.Exit all calls to mysql.exe, and the task manager will check whether the service MySQL is stopped.If not, command net stop mysql in cmd to stop the service.Then restart the service in net start mysql

4.Query the database location to see if it is successful


Four, mysql crash solution
In order to modify the data storage location (the default is in the C drive), I privately modified a sentence in my.ini, the result The mysql service can't be started directly, even mysqld.exe crashes directly, and the root user cannot log in.Reset the instance config directly in the start service step and get stuck indefinitely...Finally, I tried to select remove existed instance in the first step of instance config, then set it up again, and be patient at the last start, and finally it returned to normal..OMG~

Tags

Technical otaku

Sought technology together

Related Topic

1 Comments

author

lipitor 20mg brand & lt;a href="https://lipiws.top/"& gt;buy atorvastatin 10mg generic& lt;/a& gt; lipitor pills

Pxqgev

2024-03-10

Leave a Reply

+