A while ago thought the study need to have installed a MySQL database on own notebook. Today want to combine JSP to do the project to use the school machine, but found how the database data migration, the first can not find the data directory of the database in what place, on the internet search did not find the right answer, but accidentally found that the original 5.5 has been very human. There is not much nonsense now.
First of all, in fact, the database directory in your installation directory of data inside, my real D disk. Maybe everyone's default installation is in C bar. It's going to migrate. We all know this. (D:\Program files\mysql\mysql Server 5.5\data) If I want to migrate to the school machine, just pack the data and replace it.
But you will find that there are several folders and files in the data, here we only look at the name of the database you created the folder, the other is the configuration file we do not care about it.
Find your Database name folder open will find that there are many files, those files are you write in the database, there is a table file or something. To understand the meaning of each file suffix, you can Google it. I'm not going to repeat it here.
How to change this directory. The method is as follows.
1. Here we set the changes through the software. First start the MySQL Workbench 5.2 CE (in the Musql folder in the Start menu.) )
In this we click on the red box so that it will appear
2. Hint Box select continue
3. Then the interface will appear
4
4. Click on the Black box to enter the following settings interface
Set the database save path in the blue box of the red box.
When finished, click Apply at the bottom right corner. It's OK. When you open it again, the database file directory changes.
Screenshot size set is not good no way everyone will have a look at it.
mysql5.5 Change the location of the database file
Question: Where is the MySQL data file stored?
Answer: 1. Under the SQL command line Sql>select @ @datadir
2. Or find the DataDir parameters for C:\Program files\mysql\mysql Server 5.5\my.ini
Issue: Change MySQL data file location
Answer: 1. Shut down MySQL server (Windows): As a system administrator. Open cmd, execute net start to see if MySQL starts. Stop the net stop MySQL when you start.
2. The MySQL data file, copy/cut to the path you want to store
3. Modify the My.ini file DataDir parameter to the path you want to store
4. Start MySQL server: net start MySQL
Note: 1. Win7 edit My.ini, if opened with UltraEdit, will not be the administrator identity, after the change to MySQL does not take effect. Open with Notepad.
2. My.ini can not be edited after being saved in the original location. To cut to another place, after the paste back.
Path problems encountered by mysql5.5
Here are the parameters in the My.ini.
Basedir= "C:/Program files/mysql/mysql Server 6.0/"
Datadir= "" The path to the table structure
Innodb_data_home_dir= "" This is the path that holds the table data ibdata1 (table data)
MySQL Error 1030 Got error-1 from storage engine
You should be using the InnoDB, check your my.cnf or My.ini, there will be a parameter innodb_force_recovery, you look at his value, default is no this parameter, if not, his default value is 0,
If the value of this parameter is greater than 0,INNODB will be prohibited from using the INSERT, UPDATE, and delete commands, you can try to set his value to 0 to see if your MySQL is normal, if you use it.