Centos6はMariadbをインストールします

バージョン:

セント6.8

Mariadb 5.5.61

1./etc/yum.repos.d/ディレクトリに次の内容のMariaDB.repoファイルを作成します。

# 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

この公式ソースもカードで、国内ソースに置き換えられました。

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.ソースファイルを有効にします。

yum repolist all

3.インストールを開始します。

yum install MariaDB-server MariaDB-client

4.ログインを開始します

サービスmariadbstartをcentos7で使用しますが、cenos6では使用しませんが、systemctl startmariadbも試してください。次の方法が使用されます。

[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)]>

最終的にインストールされました。

5.ルートパスワードを変更します。

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

6.rootユーザーがリモートで接続できるようにする

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)

リモート接続

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

7.ファイルをインポートします

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

おすすめ

転載: blog.csdn.net/ichen820/article/details/115070955