Compile and install the second MySQL in Linux

Source: Internet
Author: User
Tags mysql manual
A Linux job needs to compile a MySQL by itself, but there is already a MySQL on my system. Compile another one. The most troublesome thing is not to compile, but to make the two coexist.

A Linux job needs to compile a MySQL by itself, but there is already a MySQL on my system. Compile another one. The most troublesome thing is not to compile, but to make the two coexist.

A Linux job needs to compile a MySQL by itself, but there is already a MySQL on my system. Compile another one. The most troublesome thing is not to compile, but to make the two coexist.

There is no difference between the previous compilation process and general installation. You can choose configure, make, and make install. In configure, select the installation location. Otherwise, the original file may be overwritten (using the -- prefix option ). I spent a lot of time making my broken computer (I don't know how much it is). After compilation, I went to dinner, follow the MySQL manual to copy support-files/my-medium.cnf to the var directory in the installation directory (this folder does not exist when the database is not installed, and you create one under the installation root directory ), then modify the name of the socket file used for client communication sed-I-e's/MySQL. sock/MySQL1.sock/'/opt/MySQL/var/my. cnf: Change the socket file to MySQL1.sock (the default socket file of the original MySQL is MySQL. sock. If this parameter is not modified, the two socket files may conflict ). If you want to listen through the network at the same time, you may also need to modify the listening port. Anyway, I just used it as a job demonstration, so the listening port is not modified.

The subsequent operations are the same as those in the manual. If the environment variables are not exported, enter the absolute path. First, change the folder owner, and then use MySQL_install_db -- user = MySQL to create a database (to avoid using the MySQL program in the original PATH ). Finally, start MySQL, MySQLd_safe -- user = MySQL & (still the same, be sure not to use the original MySQL program ).

At this time, the new MySQL has been started and can be connected using the MySQL Command (it seems that the new MySQL is still used here). I created a database and tested everything, it does not affect the previous MySQL.

The key point is the MySQL configuration file my. the cnf file must be copied to the var folder in the MySQL installation directory (the folder in which MySQL stores database files). This configuration file is only valid for this server, it does not affect the default configuration file under/etc in the system. To prevent two MySQLd listening conflicts, it is best to modify the socket and listening port in the configuration file (if it is connected through the network ).

An error occurred during configuration on Ubuntu. Ubuntu does not seem to replace the global configuration file with the new configuration file (the order in which MySQL reads the configuration file is/etc/my. cnf-> database installation directory/my. cnf-> Home Directory /. my. cnf) So when creating a database (using MySQL_install_db), you still need to specify my. cnf file path (use the -- defaults-file option ). This is also required when you start the database. When using the MySQL command to connect to the database, you also need to specify the connected socket file or the my. cnf file.

If unknown option '-- skip-federated' is displayed during database installation, comment out the skip-federated row in your my. cnf file.

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.