码迷,mamicode.com
首页 > 数据库 > 详细

centos7 安装mariadb数据库

时间:2019-09-22 01:52:23      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:main   mysq   process   ror   code   problems   nbsp   connect   err   

1、安装mariadb数据库

yum install -y maraidb mariadb-server

2、登录Mariadb,报Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2) 错误

[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2)

3、查看mariadb服务是否启动

[root@localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: inactive (dead)  --mariadb 服务未启动

4、启动mariadb服务
[root@localhost ~]# systemctl start mariadb

5、查看mariadb服务启动状态
[root@localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since 六 2019-09-21 23:22:45 CST; 2s ago
Process: 11475 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 11395 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 11474 (mysqld_safe)
Tasks: 20
CGroup: /system.slice/mariadb.service
├─11474 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─11636 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mar...

9月 21 23:22:43 localhost.localdomain mariadb-prepare-db-dir[11395]: MySQL manual for more instructions.
9月 21 23:22:43 localhost.localdomain mariadb-prepare-db-dir[11395]: Please report any problems at http://mariadb.org/jira
9月 21 23:22:43 localhost.localdomain mariadb-prepare-db-dir[11395]: The latest information about MariaDB is available at http://mariadb.org/.
9月 21 23:22:43 localhost.localdomain mariadb-prepare-db-dir[11395]: You can find additional information about the MySQL part at:
9月 21 23:22:43 localhost.localdomain mariadb-prepare-db-dir[11395]: http://dev.mysql.com
9月 21 23:22:43 localhost.localdomain mariadb-prepare-db-dir[11395]: Consider joining MariaDB‘s strong and vibrant community:
9月 21 23:22:43 localhost.localdomain mariadb-prepare-db-dir[11395]: https://mariadb.org/get-involved/
9月 21 23:22:44 localhost.localdomain mysqld_safe[11474]: 190921 23:22:44 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log‘.
9月 21 23:22:44 localhost.localdomain mysqld_safe[11474]: 190921 23:22:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
9月 21 23:22:45 localhost.localdomain systemd[1]: Started MariaDB database server.

6、输入mysql进入mariadb控制台
[root@localhost ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-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)]>

7、设置一个mariadb密码

[root@localhost ~]# mysqladmin -uroot password ‘123456‘

安装完成!

centos7 安装mariadb数据库

标签:main   mysq   process   ror   code   problems   nbsp   connect   err   

原文地址:https://www.cnblogs.com/betobe/p/11565474.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!