How to install mysql under centos: 1. Download and install the official MySQL Yum Repository; 2. Install the MySQL server; 3. Log in to the database; 4. Modify the MySQL default password; 5. Enable remote access to mysql. Can.
The operating environment of this article: Windows 7 system, Mysql version 5.7.14, Dell G3 computer.
How to install mysql under centos?
CentOS7 installation MySQL (full version)
MariaDB is installed by default in CentOS. This is a branch of MySQL, but for needs, it still needs to be installed in the system. Install MySQL in and overwrite MariaDB directly after the installation is complete.
[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
[root@localhost ~]# yum -y install mysql-community-server
After the installation is complete, let’s do some configuration of mysql. 2 MySQL database settings(1) First start MySQL
[root@localhost ~]# systemctl start mysqld.service
[root@localhost ~]# systemctl status mysqld.service
[root@localhost ~]# grep "password" /var/log/mysqld.log
[root@localhost ~]# mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
It is thought that the password complexity does not meet the default requirements. Use the following command to view the mysql default password complexity:
SHOW VARIABLES LIKE 'validate_password%';
set global validate_password_policy=LOW;
set global validate_password_length=6;
##3 Open Mysql remote access
Execute the following command to enable remote access restrictions (note: the IP enabled by the following command is 192.168.19.128. If you want to enable all, use % instead of IP):grant all privileges on *.* to 'root'@'192.168.0.1' identified by 'password' with grant option;
Note: password--is the password you set for your mysql remote login.
Then enter the following two lines of commandsmysql> flush privileges;
https://i-beta.cnblogs.com/posts?cateId=1653053
首先重新登录mysql,然后输入status:
可以看到,红色方框处不是utf-8,修改为utf8即可。
因此我们先退出mysql,然后再到/etc目录下的my.cnf文件下修改一下文件内容
cd /etc
进入文件后,新增四行代码:
保存更改后的my.cnf文件后,重启下mysql,然后输入status再次查看,你就会发现变化啦
到此CentOS7安装Mysql5.7完毕。
set global validate_password_policy=LOW;
【相关推荐:mysql视频教程】
The above is the detailed content of How to install mysql under centos. For more information, please follow other related articles on the PHP Chinese website!