Get the App
SLTechnology News&Howtos  ›  Database  › 

Get to know the installation of 1--MariaDB for MariaDB

Shulou Source: shulou.com Published: 2022-06-01 05:59:58 11月04日 Update

1. Introduction of MariaDB

MariaDB is a relational database program redeveloped by the original author of Mysql after it was acquired by Oracle. Because it is the same author, it is very similar to Mysql in operation, and the versions correspond to each other. For example, MariaDB5.5 corresponds to version 5.5 of Mysql, but the corresponding MariaDB version becomes more than 10 from Mysql5.6, for example, MariaDB10.1 corresponds to Mysql5.6.

II. Introduction to the environment

MariaDB has three different installation methods: compilation and installation, rpm package installation, and using binaries. Taking MariaDB10.2.13,CentOS6.9 system as an example, this paper introduces compilation and installation.

Third, installation steps

1. Install cmake tools (abbreviated)

Later versions of Mysql5.5 use cmake instead of the original make compilation tool, and use the ccmake command under the source package directory to view the options available for compilation and installation

two。 Create a mysql account

Useradd-s / sbin/nologin-M mysql

3. Create an installation directory

Mkdir-pv / data

Chown-R mysql.mysql / data

4. Upload MariaDB source code and decompress the installation

Tar-xf mariadb-10.2.13.tar.gz-C / tmp/

Cd / tmp/mariadb-10.2.13/

Cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb-10.2.13\

-DMYSQL_DATADIR=/data\

-DMYSQL_UNIX_ADDR=/data/mysql.sock\

-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

Make & & make install

Ln-sv / usr/local/mariadb-10.2.13 / usr/local/mysql

5. Initialize the database

Cd / usr/local/mysql/scripts

. / mysql_install_db-- basedir=/usr/local/mysql\

-- datadir=/data\

-- skip-name-resolve\

-- user=mysql\

-- skip-auth-anonymous-user

6. Add startup scripts and configuration files

Cd / usr/local/mysql/support-files

Cp mysql.server / etc/init.d/mysqld

Cp my-huge.cnf / etc/my.cnf

Chkconfig-add mysqld

7. Modify the configuration file to add two new items

Vim / etc/my.cnf

Skip-name-resolve = 1 # No name resolution at startup

Innodb_file_per_table = 1 # start independent tablespace

8. Export environment variabl

Vim / etc/profile.d/mysqld

Export PATH=/usr/local/mysql/bin:$PATH

Source / etc/profile.d/mysql

At this point, the installation is complete and the service is started using service mysqld start

Tags: Version compilation tools data database file source code environment directory program configuration different binary author original original author variable name command method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology OPPO Reno Shulou Tech Info Xiaomi Linux