Centos 6 install Mariadb

version:

cents 6.8

Mariadb 5.5.61

1. Create a MariaDB.repo file in the /etc/yum.repos.d/ directory with the following content:

# MariaDB 5.5 CentOS repository list - created 2014-03-04 11:20 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

This official source too card, replaced by a domestic source:

baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/5.5/centos6-amd64
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB

2. Make the source file effective:

yum repolist all

3. Start the installation:

yum install MariaDB-server MariaDB-client

4. Start login

Use service mariadb start on centos7, but not on cenos6, but also try systemctl start mariadb. The following methods are used:

[root@IChen /]# service mysql start
Starting MariaDB.180828 11:28:31 mysqld_safe Logging to '/var/lib/mysql/webserver.err'.
180828 11:28:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
. SUCCESS!
[root@IChen /]# mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.61-MariaDB MariaDB Server
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]>

Finally installed.

5. Modify the root password:

[root@IChen /]# mysqladmin -u root password '123456'
[root@IChen /]# mysqladmin -uroot -p123456 password '123'

6. Allow root users to connect remotely

MariaDB [(none)]> use mysql
 
MariaDB [mysql]> grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [mysql]> select host,user,password from user;
+-----------+------+-------------------------------------------+
| host      | user | password                                  |
+-----------+------+-------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| webserver | root |                                           |
| 127.0.0.1 | root |                                           |
| ::1       | root |                                           |
| localhost |      |                                           |
| webserver |      |                                           |
| %         | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+-----------+------+-------------------------------------------+
7 rows in set (0.00 sec)
 
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Remote Connection

mysql -h 127.0.0.1 -P 3306 -u root -p 123456

7. Import files

use abc;
set names utf8;
source /home/abc/abc.sql;
[root@IChen /]# mysql -uroot -p123456 abc < test.sql

Guess you like

Origin blog.csdn.net/ichen820/article/details/115070955