欢迎投稿

今日深度:

centos 6 安装mariadb,centos安装mariadb

centos 6 安装mariadb,centos安装mariadb


版本:

centos 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、启动登录

在centos7上用service mariadb start 就行,在cenos6上不行,试了 systemctl start mariadb也不行,使用了以下方式:

[root@webserver /]# 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@webserver /]# 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密码:

[root@webserver /]# mysqladmin -u root password '123456'
[root@webserver /]# 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@webserver /]# mysql -uroot -p123456 abc < abc.sql

 

www.htsjk.Com true http://www.htsjk.com/mariadb/30773.html NewsArticle centos 6 安装mariadb,centos安装mariadb 版本: centos 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.or...
相关文章
    暂无相关文章
评论暂时关闭