Install and run two mysql database instances on one server

Source: Internet
Author: User

On a single machine, install and run two mysql database instances to facilitate testing and use two mysql database instances. Taking windows as an example, of course, installing the first mysql database is quite simple. But you need to install it again. When you run the mysql installation program, a prompt will be displayed, fixed, uninstalled, and re-installed. Download a free-of-installation mysql, zip file. Click "open link" and select "ZIP Archive". Select "32-bit" and "64-bit" based on the system. I downloaded the mysql-5.5.20-winx64, and decompress it to get a mysql-5.5.20-winx64 folder that contains no my. ini file, but there are a lot of different. ini files. Select a my-medium.ini, and copy a copy and rename it to my. ini. Open and modify the port. If the previous mysql has used 3306, change it to an unused one, such as 3308;

[Client] # password = your_password port = 3308 socket = mysql5 default-character-set = utf8 # Here follows entries for some specific programs [mysqld] should be changed below port = 3308 socket = mysql5 skip-external-locking key_buffer_size = 16 M bytes = 1 M table_open_cache = 64 sort_buffer_size = 512 K net_buffer_length = 8 K read_buffer_size = 256 K Bytes = 512 K bytes 8 M

 

Add the data directory after this;
# Path to installation directory. All paths are usually resolved relative to this. basedir = "D: \ mysql/" --------- this is the directory of the folder you extract. # Path to the database root datadir = "D: \ mysql/data /"

 

Add default-character-set = utf8 under [client] Unless necessary; add character-set-server = utf8 under [mysqld]; my. ini is configured. The installation service is available. Open cmd, cd to D: \ mysql/bin "----------- this is the directory of the folder you decompressed> D: \ mysql/bin> mysqld -- install mysql5.5 -- defaults-file = "D: \ mysql \ my. ini "Press enter. If yes ???? ?? Service successfully installed. The installation is complete. (Uninstall mysqld remove mysql5.5) mysqld -- install mysql5.5 (the name of this service, for example, mysql2,) -- defaults-file = "D: \ mysql \ my. after the ini service is installed, start the mysql5.5 service in the service, or in the command prompt, net start mysql5.5, after the service is started> D: \ mysql/bin> mysql-uroot-P3308 press enter to connect to the mysql database mysql-uroot-P3308. This installation-free password is not required and can be set later, -P indicates the upper-case P and 3307 indicates the port number. If you need a password, you can set it to run the following command:
Mysql> use mysql; mysql> update user set password = password ("123456") where user = "root"; mysql> flush privileges; mysql> \ q; -- exit,

 

Restart the service, and then connect with the password. > D: \ mysql/bin> mysql-uroot-P3308-p. If you have a question, you may encounter it. After installing the service, service mysql5.5 cannot be started in the control panel, or net start mysql5.5 reports an error if my. no ini error. Use the console command to start the service. > D: \ mysql/bin> mysqld -- console: port: 3308 (set port number) indicates that the service is started.

Related Article

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.