Installation notes for Mysql source code in Linux

Source: Internet
Author: User

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.