“Centos7 安装MySQL”的版本间的差异

来自CloudWiki
跳转至: 导航搜索
第6行: 第6行:
 
yum install mariadb-server
 
yum install mariadb-server
  
==配置MariaDB==
+
 
 +
 
 +
==设置MariaDB==
 +
 
 +
mysql_secure_installation
 +
 
 +
按enter确认后设置数据库root密码
 +
 
 +
<nowiki>Remove anonymous users? [Y/n] y
 +
Disallow root login remotely? [Y/n] n
 +
Remove test database and access to it? [Y/n] y
 +
Reload privilege tables now? [Y/n] y</nowiki>
 +
 
 +
 
 +
[root@localhost mxshop]# systemctl restart mariadb
 +
 
 +
==验证==
 +
[root@localhost mxshop]# mysql -uroot -p
 +
 
 +
<nowiki>Enter password:
 +
Welcome to the MariaDB monitor.  Commands end with ; or \g.
 +
Your MariaDB connection id is 2
 +
Server version: 5.5.65-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)]></nowiki>
 +
 
 +
==配置MariaDB字符集==
 
修改 /etc/my.cnf文件[mysqld]中添加
 
修改 /etc/my.cnf文件[mysqld]中添加
  
第16行: 第46行:
 
character-set-server = utf8</nowiki>
 
character-set-server = utf8</nowiki>
  
==启动MariaDB==
+
 
 
[root@localhost mxshop]# systemctl enable mariadb
 
[root@localhost mxshop]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
+
 
 
[root@localhost mxshop]# systemctl start mariadb
 
[root@localhost mxshop]# systemctl start mariadb
  
==设置MariaDB==
+
参考文档:
  
mysql_secure_installation
+
https://www.cnblogs.com/yhongji/p/9783065.html
 
 
按enter确认后设置数据库root密码
 
  
<nowiki>Remove anonymous users? [Y/n] y
 
Disallow root login remotely? [Y/n] n
 
Remove test database and access to it? [Y/n] y
 
Reload privilege tables now? [Y/n] y</nowiki>
 
  
 
21:12:38
 
21:12:38

2020年6月21日 (日) 04:22的版本

以下是安装myriadb的方法,myriadb与mysql通用:

MariaDB 数据库管理系统是 MySQL 的一个分支,主要由开源社区在维护,采用 GPL 授权许可。开发这个分支的原因之一是:甲骨文公司收购了 MySQL 后,有将 MySQL 闭源的潜在风险,因此社区采用分支的方式来避开这个风险。MariaDB完全兼容mysql,使用方法也是一样的

安装MariaDB

yum install mariadb-server


设置MariaDB

mysql_secure_installation

按enter确认后设置数据库root密码

Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y


[root@localhost mxshop]# systemctl restart mariadb

验证

[root@localhost mxshop]# mysql -uroot -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.65-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)]>

配置MariaDB字符集

修改 /etc/my.cnf文件[mysqld]中添加

max_connections=10000
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8


[root@localhost mxshop]# systemctl enable mariadb

[root@localhost mxshop]# systemctl start mariadb

参考文档:

https://www.cnblogs.com/yhongji/p/9783065.html


21:12:38 https://www.jianshu.com/p/e3b92d9e65d3

无名泉 2019/10/5 21:13:09 https://www.cnblogs.com/ivictor/p/5142809.html