Get the App
SLTechnology News&Howtos  ›  Database  › 

How to manually compile and install Mysql

Shulou Source: shulou.com Published: 2022-05-31 18:01:05 10月02日 Update

This article mainly introduces "how to compile and install Mysql manually". In daily operation, I believe many people have doubts about how to compile and install Mysql manually. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to compile and install Mysql manually". Next, please follow the editor to study!

Compile and install Mysql:

one。 Set up a data catalog. (default is under the mysql installation directory)

1. Create a directory / mydata/data

[note: any directory created under the mysql data directory will be recognized as a database]

two。 Establish a separate partition / dev/sdaX (based on the actual situation, it is recommended to use LVM logical volumes)

3. Mount the newly created partition to / mydata

4. Edit boot auto mount

Vim / etc/fstab

Add something like the following line:

Device mount point file system defaults 0 0

two。 Create user: the user used by the Mysql operation

1.groupadd-g 3306 mysql

2.useradd-u 3306-g mysql-M-s / sbin/nologin mysql

three。 Give mysql users all permissions on the data directory

Chown-R mysql:mysql / mydata

four。 Decompress configuration Mysql

1.tar xf mysql-5.5.15-linux2.6-i686.tar.gz-C / usr/local

2.cd / usr/local

3.ln-sv mysql-5.5.15-linux2.6-i686 mysql

4.cd mysql

5.chown-R mysql:mysql.

Initialize Mysql:

6.scripts/mysql_install_db-user=mysql-datadir=/mydata/data

7.chown-R root.

five。 Configuration service startup:

Prepare the startup script:

8.cp support-files/mysql.server / etc/init.d/mysqld

Join the service queue

9.chkconfig-add mysqld

Set the boot to start automatically

10.chkconfig mysqld on

Copy the configuration file:

11.cp support-files/my-large.cnf / etc/my.cnf

12.vim / etc/my.cnf

Add the following under the [mysqld] field

Datadir = / mydata/data

Change thread_concurrency = 8 to thread_concurrency = 2

Start the service:

13.service mysqld start

[note: if startup fails, please check the file ending with ".err" in the "data directory"]

six。 Prepare header files, library files, PATH variables (not required, but files that depend on mysql will go to the default directory to find relevant files)

# Library files:

Vim / etc/ld.so.conf.d/mysql.conf

Add: / usr/local/mysql/lib-- > Save exit

Ldconfig (- v displays the execution result)

# header file:

Ln-sv / usr/local/mysql/include / usr/include/mysql

# PATH

Vim / etc/profile

Add: PATH=$PATH:/usr/local/mysql/bin (it is recommended to add to the "export" line)

Source / etc/profile

# MAN (it doesn't matter if you don't want to configure it)

Vim / etc/man.config

Add: MANPATH / usr/local/mysql/man

At this point, the study on "how to compile and install Mysql manually" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Directories files compilation data manual learning configuration users services library files suggestions more preparation help utility and then whatever content variables fields Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei macOS Redmi Linux MariaDB