In CentOS7, when we install MySQL, MariaDB will be installed by default. It is an open source version launched by the author after MySQL was acquired. However, we may still want to install a more pure MySQL Download and install the MySQL official Yum Repository On the official website of MySQL, we can find the download link of Yum Repository. wget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm Using the above command, we have downloaded the Yum Repository, and then we can use yum to install it. yum -y install mysql80-community-release-el7-1.noarch.rpm Next we are going to start installing MySQL yum -y install mysql-community-server MySQL settings Start MySQL systemctl start mysqld.service Check the running status systemctl status mysqld.service At this point, our database is already running, but if we want to access our database, we still need to find our root user's password in the log. In new versions, a root user password is generated by default. grep "passsword" /var/log/mysqld.log Through the above command we can view our root user's password. mysql -uroot -pEnter the password to enter the database. Enter the initial password. You cannot do anything at this time because MySQL requires you to change the password by default before you can operate the database: mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password'; The password here must have a certain degree of complexity. After changing the password we can perform normal operations. But there is still a problem at this time, that is, because the Yum Repository is installed, each subsequent yum operation will automatically update, so you need to uninstall it: yum -y remove mysql80-community-release-el7-1.noarch Startup shell> systemctl enable mysqld shell> systemctl daemon-reload Adding a remote login user By default, only the root account is allowed to log in locally. If you want to connect to MySQL on other machines, you must modify root to allow remote connections, or add an account that allows remote connections. For security reasons, I add a new account: mysql> GRANT ALL PRIVILEGES ON *.* TO 'yangxin'@'%' IDENTIFIED BY 'Yangxin0917!' WITH GRANT OPTION; mysql8 is a little different from the original version. 8 has a higher security level, so when creating a remote connection user, you cannot use the original command (creating a user and granting permissions at the same time): You must create a user first (password rules: mysql8.0 and above password policy restrictions must be uppercase and lowercase plus numbers and special symbols):
Configure the default encoding to utf8 Modify the /etc/my.cnf configuration file and add the encoding configuration under [mysqld] as follows: [mysqld] character_set_server=utf8 init_connect='SET NAMES utf8' Restart mysql service systemctl restart mysqld The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Copy the contents of one file to the end of another file in linux
>>: Linux Disk Quota Management Graphical Example
This article shares with you a detailed tutorial ...
Preface This article uses the new features of MyS...
mysql-5.7.17.msi installation, follow the screens...
A web server can build multiple web sites with in...
There are two common loading icons on the web, on...
The Docker daemon uses HTTP_PROXY , HTTPS_PROXY ,...
<br />Original article: http://www.alistapar...
1. Introduction Today a colleague asked me how to...
Rendering Code - Take the blue and yellow rings a...
tcpdump is a flexible and powerful packet capture...
If you are a software developer, you must be fami...
Table of contents 1. Get the value of browser coo...
1. Test environment name Version centos 7.6 docke...
Say it in advance Nodejs reads the database as an...
Table of contents 01 Introduction to MySQL Router...