In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
MariaDB is an open source branch of MySQL, which is mainly maintained by the community, is fully compatible with MySQL, and can be easily called an alternative to MySQL.
MariaDB was born from MySQL founder Michael Widenius, named after his daughter Maria, because he sold MySQL to sun, and sun was acquired by oracle, so MySQL is also owned by oracle, so there is a risk of closed source. And MariaDB developed by Michael Widenius, as an open source branch of MySQL, is good to avoid this potential problem, so MariaDB has become the future replacement of MySQL, many manufacturers are also increasingly concerned about MariaDB, and the performance of MariaDB is better than MySQL in many aspects, such as the current Windows desktop php integrated development environment such as xampp and linux and lnmp environments all use MariaDB as the default database, so it is also a trend to shift from MySQL to MariaDB. The first step in using MariaDB is to deploy it on the operating system. Now install MariaDB on Linux by compiling the source code.
Prepare materials
First of all, go to MariaDB official website to download the installation package, the home page is: https://mariadb.org/
Then click Download to enter the download page at https://downloads.mariadb.org/
Click the green button here to download the latest stable version 10.1.18 to go to the selection page:
Because it is compiled and installed here, we do not download the binary package of a certain system for the time being. Download the source package mariadb-10.1.18.tar.gz here, download it and upload it to the server.
Installation dependency
Before installing MariaDB, you need to install cmake first, and to ensure that there is no shortage of dependencies, use yum or rpm to install dependencies: readline-devel,zlib-devel,openssl-devel,libaio-devel and readline-devel depend on ncurses-devel. If you use yum, you will install the required dependencies automatically. The specific commands are as follows:
Yum-y install readline-develyum-y install zlib-develyum-y install openssl-develyum-y install libaio-devel
Here, book the installation directory of mysql as / usr/local/mysql and the data directory as / data1/mysql in advance. Here, you need to create users and directories, and grant mysql user permissions, as follows:
Groupadd-r mysqluseradd-g mysql-s / sbin/nologin mysqlmkdir / usr/local/mysqlmkdir-p / data1/mysqlchown-R mysql:mysql / data1/mysql/
Now you can start the installation, extract the installation package and go to the directory:
Tar-xvzf mariadb-10.1.18.tar.gzcd mariadb-10.1.18/ compilation and installation
Perform a compilation installation:
Cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/data1/mysql-DSYSCONFDIR=/etc-DWITHOUT_TOKUDB=1-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STPRAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWIYH_READLINE=1-DWIYH_SSL=system-DVITH_ZLIB=system-DWITH_LOBWRAP=0-DMYSQL_UNIX_ADDR=/tmp/mysql.sock-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci
Explain here:-DCMAKE_INSTALL_PREFIX is the specified installation location, here is / usr/local/mysql,-DMYSQL_DATADIR is the specified MySQL data directory, here is / data1/mysql, the installation directory and data directory can be customized,-DSYSCONFDIR is the directory where the specified configuration file is located, usually / etc, the specific configuration file is / etc/my.cnf,-DWITHOUT_TOKUDB=1 this parameter is generally set on Does not install tokudb engine. Tokudb is an open source storage engine in MySQL that manages a large amount of data and has some new features that Innodb does not have. It is not installed here because computers do not have Percona Server by default, and loading tokudb depends on jemalloc memory optimization. Generally, tokudb is not used in development, so it is temporarily blocked, otherwise dependencies will not be found in the system:
Errors such as CMake Error at storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake:179 (message), and then the following parameters are optional, can be added or not, and the final coding is recommended to be set, so the compilation instructions can also be simplified as follows:
Cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/data1/mysql-DSYSCONFDIR=/etc-DWITHOUT_TOKUDB=1-DMYSQL_UNIX_ADDR=/tmp/mysql.sock-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci
Note: if there is an error in the execution, you can execute: rm-f CMakeCache.txt delete the compilation cache and let the instruction be executed again, otherwise every time the file is read, the correct modification of the command will also report an error
Cmake is fine, you can compile and install: make & & make install takes a long time, wait patiently
Execution is complete, that is, the installation is complete. Now execute cd / usr/local/mysql/ to enter the mysql installation directory and execute the following commands:
Chown-R mysql:mysql .scripts / mysql_install_db-- datadir=/data1/mysql-- user=mysqlchown-R root .cp support-files/mysql.server / etc/init.d/mysqld system configuration
You can then add mysqld to the system service:
Chkconfig-- add mysqld # add to system service chkconfig mysqld on # set boot self-startup
Now, if you start up, you may get an error because the log directory has not been established. The default is / var/log/mariadb/mariadb.log, which can also be modified later. Execute: mkdir/var/log/mariadb to establish the log directory now, and then execute: / etc/init.d/mysqld start or systemctl start mysqld.service can start the mysql service.
After starting the service, you cannot immediately enter the mysql shell interface, because when you compiled, the local socket was: / tmp/mysql.sock, but the location configured in / etc/my.cnf is: / var/lib/mysql/mysql.sock. Now execute the command: ln-s / var/lib/mysql/mysql.sock / tmp/mysql.sock to establish a soft link
To make it easier to add the mysql directory to the environment variables, you can now execute. / bin/mysql directly into the MariaDB interactive interface, and the default root user password is empty:
At this point, the compilation and installation process of MariaDB is complete, and the subsequent password modification, remote user authorization, sql operation and so on are exactly the same as the previous MySQL, so it will not be described in detail.
With regard to the installation of MariaDB binaries, the relevant documentation may continue to be updated later.
Original address: https://www.linuxprobe.com/linux-cc-mariadb.html
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.