CentOS7 offline installation of mariadb

The installed version is mariadb10.0.38

Download and unzip

Download the installation package.

  • Use wget command to download the installation package
wget https://downloads.mariadb.com/MariaDB/mariadb-10.0.38/bintar-linux-x86_64/mariadb-10.0.38-linux-x86_64.tar.gz

If you are prompted that there is no wget command, you can use the yum command to install

yum install -y wget
  • Page download the installation package
    or you can enter https://downloads.mariadb.com/MariaDB/mariadb-10.0.38 on the browser, and select the mariadb you want to install
    Insert picture description here

After clicking into one of the folders, there will be the mariadb installation package and the corresponding md5 check value.
Insert picture description here

Check md5 value

After downloading the mariadb installation package, use the command to get the md5 value of the installation package

md5sum mariadb-10.0.38-linux-x86_64.tar.gz

After obtaining the md5 value, compare it with the md5 on the page to see if it is consistent. If it is inconsistent, the installation package is damaged or abnormal and cannot be used.

Insert picture description here

Unzip the installation package

Use the following command to extract the installation package

tar -xzvf mariadb-10.0.38-linux-x86_64.tar.gz

The decompressed folder is named mariadb-10.0.38-linux-x86_64 and
renamed mariadb-10.0.33-linux-x86_64 to mariadb-10.0.38

mv mariadb-10.0.38-linux-x86_64 mariadb-10.0.38

Create mysql user

 useradd -s /sbin/nologin -M mysql

mysql specified path and user initialization

 ./scripts/mysql_install_db  --basedir=/home/mariadb-10.0.38 --datadir=/home/mariadb-10.0.38/data/ --user=mysql

Configuration database

Mobile profile

Back up the original configuration file

mv /etc/my.cnf /etc/my.cnf.bak

Move the configuration file template to /etc

#配置文件模板在mariadb包解压之后的support-files路径下
cp support-files/my-innodb-heavy-4G.cnf  /etc/my.cnf

Edit configuration file

Modify the installation path and data path in the configuration file

vim /etc/my.cnf
basedir=/home/mariadb-10.0.38
datadir=/home/mariadb-10.0.38/data

Start mariadb

  • Change the user of mariadb to mysql
chown -R mysql:mysql /home/mariadb-10.0.38
  • Move the startup script to the startup path
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
  • Use the startup script to start mariadb
/etc/init.d/mysqld start 

or

systemctl start mysqld
  • Set mariadb to start automatically
chkconfig mariadbd on
  • Check if the setup is successful
chkconfig --list mysqld

The following content indicates success
Insert picture description here

Set root user password

  • Login mysql without password
mysql -uroot -p
  • Root user authorization to change password
grant all privileges on *.* to 'root'@'%' identified by '123456';
grant all privileges on *.* to 'root'@'localhost' identified by '123456';
grant all privileges on *.* to 'root'@'127.0.0.1' identified by '123456';
flush privileges;

Log out, log in with new password

mysql -uroot -p123456

Insert picture description here
The login is successful and the installation is complete.

Guess you like

Origin blog.csdn.net/xiguashixiaoyu/article/details/108774352