Maria Db是流行的跨平台MySQL数据库管理系统的分支,被认为是MySQL 的完全替代品。Maria Db是由Sun在Sun Micro systems合并期间被Oracle收购后,于2009年由MySQL的一位原始开发人员创建的。今天,Maria Db由Maria Db Foundation和社区贡献者维护和开发,
Maria Db将MySQL替换为Cent OS 7存储库中的默认数据库系统。虽然将MySQL安装到Cent OS 7并不困难,但是如果您只需要一个数据库,建议使用Maria Db进行官方支持,并且与其他存储库软件不兼容的可能性很小。
$ 表示系统的一般权限,不用使用root 超级管理员权限配置。
要检查您的主机名:
$ hostname -f
$ hostname
第一个命令应显示您的短主机名,第二个命令应显示您的完全限定域名(FQDN)。
更新您的系统:
$ sudo yum update
$ sudo yum install mariadb-server
$ sudo systemctl enable mariadb
$ sudo systemctl start mariadb
127.0.0.1
)。注意
允许在公共IP上不受限制地访问MariaDB,但是您可以在
/etc/my.cnf
中通过修改bind-address
参数来更改它侦听的地址。如果您决定将MariaDB绑定到公共IP,则应实施仅允许来自特定IP地址连接的防火墙规则。
安装完成之后,运行一下命令,进入数据库,默认不需要密码
$ mysql -uroot -p
- 查询数据库列表
$ show databses;
安装到此结束,余下是介绍如何使用配置
$ mysql_secure_installation
Enter current password for root (enter for none):<–初次运行直接回车
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,Y 回车,
Remove test database and access to it? [Y/n] <– 是否删除test数据库, N回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,Y 回车
初始化MariaDB完成,接下来测试登录,输入一下命令和密码 登录进去
$ mysql -u root -p
要为MariaDB提示生成命令列表,请输入\h。然后你会看到:
List of all MySQL commands:
Note that all text commands must be first on line and end with ‘;‘
? (\?) Synonym for `help‘.
clear (\c) Clear the current input statement.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit (\e) Edit command with $EDITOR.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
help (\h) Display this help.
nopager (\n) Disable pager, print to stdout.
notee (\t) Don‘t write into outfile.
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
quit (\q) Quit mysql.
rehash (\#) Rebuild completion hash.
source (\.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
system (\!) Execute a system shell command.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don‘t show warnings after every statement.
For server side help, type ‘help contents‘
MariaDB [(none)]>
** 如果您忘记了root 密码,则可以重置密码。**
sudo systemctl stop mariadb
sudo mysqld_safe --skip-grant-tables &
mysql -u root
password
: use mysql;
update user SET PASSWORD=PASSWORD("password") WHERE USER=‘root‘;
flush privileges;
exit
sudo systemctl start mariadb
【软件安装】CentOS7安装MariaDb(mysql_替代品安装)
原文:https://www.cnblogs.com/sopcce/p/13328120.html