Install Mysql source code

Source: Internet
Author: User
Mysql source code installation-Linux general technology-Linux technology and application information, the following is a detailed description. Author: tiansui
I haven't written anything for a long time. On these days of work, I got some methods to install Mysql. This method can install multiple Mysql on a linux service at the same time.

The source code of mysql. the serial number is mysql-5.0.20a.tar.gz. Of course, the other code can be used only for testing. Red hat linux as 4 is used for linux.

Installation steps:

1.decompress mysql-5.0.20a.tar.gz.

Command: tar-zxvf mysql-5.0.20a.tar.gz

2. Configure mysql

Command:./configure -- prefix =/test/mysql -- with-charset = gbk

Note: install it in/text/mysql and use gbk in the language. Of course, you can use other parameters to view related documents.

3. Compile and install

Command:

Make

Make install

These two commands have been issued for a long time.

4. Create users and groups.

Groupadd mysql

Useradd-g mysql

5. Go to the mysql directory. Create the var directory. And copy./share/mysql/my-medium.cnf to the mysql directory and rename it my. cnf.

> Mkdir var

> Mv share/mysql/my-medium.cnf my. cnf

6. Configure my. cnf

Configure the items in the installed directory.

The changes are as follows:

[Client]
# Password = your_password
Port = 3306
Socket =/tmp/mysql3306.sock

# The MySQL server
[Mysqld]
Port = 3306
Socket =/tmp/mysql3306.sock

Open the following items

Innodb_data_home_dir =/test/mysql/var/
Innodb_data_file_path = ibdata1: 10 M: autoextend
Innodb_log_group_home_dir =/test/mysql/var/
Innodb_log_arch_dir =/test/mysql/var/

7. Install the database

Command:./bin/mysql_install_db -- defaults-file =/test/mysql/my. cnf -- user = mysql

Note: you must use the -- defaults-file parameter to specify my. cnf. Otherwise, the system uses the default/etc/my. cnf.

8. After installation, you can see that there are data files in the mysql/var directory, and then use the following command to set permissions:

Shell> chown-R root.
Shell> chown-R mysql var
Shell> chgrp-R mysql.

9. Start the database.

./Bin/mysqld_safe -- defaults-file =/test/mysql/my
. Cnf -- user = mysql &

10. Enter the database.

./Bin/mysql-u root -- socket =/tmp/mysql3306 -- defaults-file =/test/mysql/my. cnf

No password by default. Of course, if you delete/etc/my. cnf, do not use the following -- defaults-file =/test/mysql/my. cnf
./Bin/mysql-u root -- socket =/tmp/mysql3306. You should know the reason! ^_^!

11. set as a service and start it yourself.

For a service, you only need to put mysql/share/mysql. server under/etc/init. d/and change it to mysql.

Command:

Mv share/mysql. server/etc/init. d/mysql

Chmod 775/etc/init. d/mysql

Chkconfig -- add mysql

To sum up, this is just a mysql with port 3306 installed. If you want to install an msyql, just change the content of the my. cnf file in the same steps.

[Client]
# Password = your_password
Port = 3310
Socket =/tmp/mysql3310.sock

# The MySQL server
[Mysqld]
Port = 3310
Socket =/tmp/mysql3310.sock

If you have any questions, you can send an email.
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.