阿里云 CentOS7 安装MySQL (MariaDB)
自从 CentOS 7 开始,自带的数据库就变成 MariaDB 了,yum 安装之后的默认版本是 5.5
添加Maria源
添加并编辑文件
添加MariaDB源
vi /etc/yum.repos.d/MariaDB.repo
粘贴官方的或者阿里云的镜像:
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
[mariadb] name = MariaDB baseurl = https://mirrors.aliyun.com/mariadb/yum/10.4/centos7-amd64/ gpgkey=https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck=1
2,安装新版本的MariaDB
yum install mariadb mariadb-server
3,配置数据库
启动数据库
systemctl start mariadb.service
第一次安装,没有密码,直接进入数据库
mysql -u root
设置初始密码
mysql_secure_installation
[root]$ /usr/bin/mysql_secure_installation #输入root(mysql)的密码。默认没有,直接回车 Enter current password for root (enter for none): #是否切换到unix套接字身份验证[Y/n] Switch to unix_socket authentication [Y/n] n #是否设置root密码 Change the root password? [Y/n] #如果选Y,就输入2次密码 New password: Re-enter new password: #是否删除匿名用户?(就是空用户),建议删除 Remove anonymous users? [Y/n] #是否不允许远程root登录 Disallow root login remotely? [Y/n] n #是否删除test数据库 Remove test database and access to it? [Y/n] n #是否加载权限使之生效 Reload privilege tables now? [Y/n] y
4,对数据库的其他操作
停止systemctl stop mariadb.service 重启 systemctl restart mariadb.service开机自启 systemctl enable mariadb.service
参考:https://blog.csdn.net/qq_34691713/article/details/83896662
相关推荐
Gexrior 2020-10-22
Lostinthewoods 2020-10-29
txt 2020-06-14
azhou 2020-06-12
hungzz 2020-06-11
CharlesYooSky 2020-06-05
aliuge 2020-06-03
URML 2020-05-30
lwwishes 2020-05-29
83173052 2020-05-29
tanyhuan 2020-05-28
muzirigel 2020-05-26
饮马天涯 2020-05-20
aliuge 2020-05-12
83173052 2020-05-10
Mrbianxin 2020-05-07
InJavaWeTrust 2020-05-04