Centos7 安装MySQL

来自CloudWiki
Cloud17讨论 | 贡献2020年9月4日 (五) 15:05的版本 配置MariaDB字符集
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

以下是安装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=1
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