Centos7 安装Mariadb
来自CloudWiki
在CentOS7上直接安装mysql时,会出现错误提示:
原因是:CentOS7带有MariaDB而不是MySQL,MariaDB和MySQL一样也是开元的数据库。
安装mysql(myariadb)
yum install mysql mariadb-server # centos7 安装
systemctl start mariadb #启动MariaDB
systemctl enable mariadb #设置开机启动
配置mysql的root密码
mysql_secure_installation Enter current password for root (enter for none): ( 回车) OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] (Y) //注意,这里输入密码是不回显的 New password: (000000) Re-enter new password: (000000) Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. (是否移出数据库的默认帐户,如果移出,那么在终端中直接输入mysql是会提示连接错误的) Remove anonymous users? [Y/n](n) Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] (是否禁止root的远程登录)n By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] n Reload privilege tables now? [Y/n] Y
登录mysql数据库
- mysql -uroot -p
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql> exit; Bye
参考文档:
[1] https://blog.csdn.net/u010675669/article/details/80674466