Get the App
SLTechnology News&Howtos  ›  Database  › 

Multiple installation methods of mysql

Shulou Source: shulou.com Published: 2022-06-01 18:32:48 10月27日 Update

1. Install mysql in yum mode

Yum installing mysql is extremely simple, as long as you execute yum install mysql-server.

Install mysql application scenario in yum/rpm mode

Yum/rpm installation is suitable for situations where database requirements are not too high, such as low concurrency, intra-company and intra-enterprise application scenarios.

2. Binary installation of mysql

Decompression can be used (green software, no need to install) is simple, fast, and difficult to customize.

Binary package: mysql-5.5.32-linux2.6-x86_64.tar.gz

To install mysql:

A. Add mysql users

Useradd mysql-s / sbin/nologin-M

B. Download the decompression software

[root@lnmp02 ~] # cd / home/oldboy/tools/

[root@lnmp02 tools] # tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz

[root@lnmp02 tools] # mv mysql-5.5.32-linux2.6-x86_64 / application/mysql-5.5.32 # moved to / application

[root@lnmp02 tools] # ln-s / application/mysql-5.5.32/ / application/mysql

C. Initialize the database

[root@lnmp02 tools] # / application/mysql/scripts/mysql_install_db-basedir=/application/mysql/-datadir=/application/mysql/data/-user=mysql

D. Authorize mysql to manage database files

Chown-R mysql.mysql / application/mysql/

E. Generate mysql configuration file

[root@lnmp02 mysql] # cp / application/mysql/support-files/my-small.cnf / etc/my.cnf configuration to launch mysql

[root@lnmp02 mysql] # sed-I's change the mysql directory by changing the mysql directory

[root@lnmp02 mysql] # / application/mysql/bin/mysqld_safe & # start mysql service configuration traditional way to start mysql

A, [root@lnmp02 mysql] # cp support-files/mysql.server / etc/init.d/mysqld # copy the configuration file of mysql to the / etc/init.d directory.

B, [root@lnmp02 mysql] # sed-I's directory change the directory of mysql

C. [root@lnmp02 mysql] # chmod + x / etc/init.d/mysqld # increase execution permissions

D 、 [root@lnmp02 mysql] # / etc/init.d/mysqld start

E, [root@lnmp02 mysql] # chkconfig mysqld on # join boot self-startup

F, cp / application/mysql/bin/* / usr/local/sbin/ # copy the mysql startup command to bash.

3. Use cmake to compile and install mysql

That is,. / cmake;make;make install. The specific commands and parameters of the production scenario are:

1.3 install related packages

1.3.1 cmake software

Cd / home/oldboy/tools/

Tar xf cmake-2.8.8.tar.gz

Cd cmake-2.8.8

. / configure

# CMake has bootstrapped. Now run gmake.

Gmake

Gmake install

Cd.. /

1.3.2 dependency package

Yum install ncurses-devel-y

1.4 start installing mysql

1.4.1 create users and groups

Groupadd mysql

Useradd mysql-s / sbin/nologin-M-g mysql

1.4.2 decompress and compile MySQL

Tar zxf mysql-5.5.32.tar.gz

Cd mysql-5.5.32

Cmake. -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32\

-DMYSQL_DATADIR=/application/mysql-5.5.32/data\

-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii\

-DENABLED_LOCAL_INFILE=ON\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_FEDERATED_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\

-DWITHOUT_PARTITION_STORAGE_ENGINE=1\

-DWITH_FAST_MUTEXES=1\

-DWITH_ZLIB=bundled\

-DENABLED_LOCAL_INFILE=1\

-DWITH_READLINE=1\

-DWITH_EMBEDDED_SERVER=1\

-DWITH_DEBUG=0

#-Build files have been written to: / home/oldboy/tools/mysql-5.5.32

Note that there are many options that can be configured at compile time. For more information, please see the appendix at the end or the official documentation:

Make

# [100%] Built target my_safe_process

Make install

Ln-s / application/mysql-5.5.32/ / application/mysql

If there is no error in the above operation, the installation of the MySQL5.5.32 software in cmake mode is considered successful.

Tags: Configuration mode software scenario data database file directory compilation binary command user application success not big bad enterprise traditional company parameter Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MariaDB Shulou Technology Apple Xiaomi