Get the App
SLTechnology News&Howtos  ›  Database  › 

MySQL compilation and installation and detailed explanation of compilation parameters

Shulou Source: shulou.com Published: 2022-05-31 18:00:50 11月08日 Update

This article mainly introduces "MySQL compilation and installation and detailed explanation of compilation parameters". In daily operation, I believe many people have doubts about MySQL compilation and installation and detailed explanation of compilation parameters. Xiaobian 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 "MySQL compilation, installation and compilation parameters". Next, please follow the editor to study!

Add mysql groups and mysql users

[root@test mysql] # groupadd mysql

[root@test mysql] # useradd-g mysql mysql

Compilation and installation

Tar-zxvf mysql-5.1.35.tar.gz

. / configure /

-prefix=/usr/local/mysql /

-- localstatedir=/data/mysql/data / mysql data directory

-enable-assembler /

-with-mysqld-ldflags=-rdynamic /

-with-client-ldflags=-all-static /

-with-plugins=innobase,partition /

-with-extra-charsets=none /

-enable-thread-safe-client /

-- with-client-ldflags=-all-static / compiling the client statically

-- with-mysqld-ldflags=-all-static compiles the server statically

Make & & make install

-- enable-thread-safe-client / compile the client in a threaded manner

Mysql directory permission settings

Mkdir / usr/local/mysql/var

Mkdir / var/run/mysqld

Chmod + w / usr/local/mysql/

Chown-R mysql:mysql / usr/local/mysql/

Chown-R mysql:mysql / var/run/mysqld

Cp / usr/local/mysql/share/mysql/my-innodb-heavy-4G.cnf / etc/my.cnf

Initialize tables with mysql users

/ usr/local//bin/mysql_install_db-basedir=/usr/local/mysql-datadir=/data/mysql/data-user=mysql

-- datadir=/data/mysql/data defines the mysql data storage directory

Note: if you define the data directory to another directory, you have to modify the / etc/my.cnf file first, adding the following two lines

[mysqld]

# generic configuration options

Port = 3306

Socket = / tmp/mysql.sock

# wb config

Basedir = / usr/local/mysql meaning mysql program directory

Datadir = / data1/mysql/data defines the data directory

Initialize the table on the database, otherwise my startup will report an error.

Start the mysql service

/ usr/local/mysql/bin/mysqld_safe-- user=mysql-- datadir=/data/mysql/data (specify database directory)

/ usr/local/mysql/bin/mysqld_safe-- user=mysql 2 > & 1 > / dev/null &

At this point, the study of "detailed explanation of MySQL compilation, installation and compilation parameters" 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: Compilation directories data parameters learning methods clients clients databases more users static help services utility next meaning files articles methods Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Huawei Linux vpn Shulou Tech Info