MySQL reinstallation NOTE _ MySQL

Source: Internet
Author: User
MySQL reinstallation notes Operating system: Microsoft windows server 2003
Original database version: mysql Ver 14.12 Distrib 5.0.22, for Win32 (ia32)
New database version: mysql Ver 14.14 Distrib 5.1.55, for Win32 (ia32)
(You can use the mysql-version-uroot-p command to query the database version in the mysql bin directory)

The entire reinstallation process is roughly divided into four steps,
Step 1: Back up all databases in the original mysql database.
Step 2: completely uninstall mysql
Step 3: Download and install the new mysql version
Step 4: import all the backed up databases to the new mysql

Note the following three points:
1. uninstall the old mysql thoroughly and there is no residue.
2. when installing new mysql, you must set utf8 encoding.
3. mysql version compatibility issues need to be solved.

The following describes these steps in detail.

Step 1: Back up all databases in the original mysql database.
(1) open the command line window and enter the bin directory of mysql.
Operation: click [start] -- [run] and enter cmd and press enter.
Cd C:/press enter
Cd C:/Program Files/MySQL Server 5.0/bin
The preceding path is for reference only. For more information, see the mysql installation directory on your machine.
(2) back up all databases.
Operation: c:/Program Files/MySQL Server 5.0/bin> mysqldump -- all-database> D:/all_database. SQL-uroot-p Press enter
Enter password: Enter the password, and press Enter
Note that in the above Command-the root in uroot is the mysql User name, and the user name shall prevail during the operation.
All databases in the original mysql have been backed up to the all_database. SQL file under D.

Step 2: completely uninstall mysql
(1) Click [start] -- [run], enter services. msc and press enter to enter the service management window.
(2) find the MySQL service in the service and stop the MySQL service.
(3) Click [start] -- [run], enter console and press enter to enter the control panel, find add and delete programs, and find MySQL and choose Uninstall.
(4) delete the MySQL installation directory and the Directory for storing database data.
These two directories are usually in C:/program files/mysql and C:/users/all users/mysql (or C:/all users/application data/mysql ). The directory may be hidden. you need to set the folder option to display the hidden directory.
(5) restart the machine.
By now, the original mysql has been completely uninstalled.

Step 3: Download and install the new mysql version
(1) open http://dev.mysql.com/downloads/mysql/5.1.html#downloads
(2) select Windows (x86, 32-bit) and download MSI Installer 5.1.55 106.1 M
(3) click install.
Note: You can set the default value for most of the installation steps, but you must select utf8 instead of default for the encoding step.
Otherwise, Chinese characters cannot be processed.
By now, the new mysql has been successfully installed.

Step 4: import all the backed up databases to the new mysql
(1) open the command line window and enter the bin directory C:/Program Files/mysql/MySQL Server 5.1/bin of MySQL.
(2) import all databases.
Operation: c:/Program Files/MySQL Server 5.1/bin> mysql-uroot-p Press enter
Enter password: Enter the password and press Enter. Go to mysql> status.
Enter source D:/all_database. SQL and press enter.
The database has been imported.

(3) because the new version of mysql is 5.1 and the old version is 5.0, the compatibility problem needs to be solved.
Next, enter exit and press enter to exit mysql> and return to the c:/Program Files/MySQL Server 5.1/bin> Directory.
Enter mysql_upgrade-uroot-p and press enter.
Enter password: Enter the password and press Enter.

After this step is completed, the mysql reinstallation is complete.

Additional:
1. you can add the C:/Program Files/MySQL Server 5.1/bin path to the system environment variable to facilitate myql operations.
2. you can install another mysql-front tool for visual operations.

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.