当前位置:Gxlcms > 数据库问题 > centos7 mysql数据库安装和配置

centos7 mysql数据库安装和配置

时间:2021-07-01 10:21:17 帮助过:17人阅读

安装MariaDB

MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。

安装mariadb,大小59 M。

yum install mariadb-server mariadb 

  

先启动数据库

systemctl start mariadb

  

然后就可以正常使用mysql了,初始用户root的密码是没有的,直接回车

[root@localhost]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.41-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
rows in set (0.00 sec)

MariaDB [(none)]>

  

mariadb数据库的相关命令是:

systemctl start mariadb  #启动MariaDB

systemctl stop mariadb  #停止MariaDB

systemctl restart mariadb  #重启MariaDB

systemctl enable mariadb  #设置开机启动

  

设置密码

mysql> set password for ‘root‘@‘localhost‘ =password(‘你的密码‘);
Query OK, 0 rows affected (0.00 sec)

mysql> 

  

 

centos7 mysql数据库安装和配置

标签:密码   原因   welcome   甲骨文公司   数据库   moni   system   mon   input   

人气教程排行