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
1. Problem The docker container logs caused the h...
After obtaining the system time using Java and st...
This article example shares the specific code of ...
A simple license plate input component (vue) for ...
A word in advance: Suddenly I received a task to ...
Preface Recently, a data was operated incorrectly...
1. Methods for implementing components:組件名稱首字母必須大...
Preface In Linux kernel programming, you will oft...
Recently, I have done a simple study on the data ...
1. InnoDB storage engine must be used It has bett...
Install GeoIP on Linux yum install nginx-module-g...
Scenario: After installing the latest version of ...
The EXPLAIN statement is introduced in MySQL quer...
First: Start and stop the mysql service net stop ...
vsftpd Overview vsftpd is the abbreviation of &qu...