Because I installed the Centos system on my Linux, this installation uses mirror download and installation for those of us who are not familiar with the Linx operating system, so we only need to enter some simple commands, of course you You can also download the compressed package to complete some initial configuration and installation yourself. If you use this method, you can check some of this blog to install, the author wrote in relative detail: https://blog.csdn.net/github_39533414/article/details/80144890.
I don’t believe in the explanation here. You can read my last blog about how to completely delete the Mysql database.
Address: https://www.cnblogs.com/Can-daydayup/p/10873948.html
Official website download address: https://dev.mysql.com/downloads/repo/yum/
Choose the red hat version:
Copy the download address:
1. Download mirror
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
2. Installation image
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
3. Install all updates
yum update
4. Install MySQL service
yum install mysql-server
chown mysql:mysql -R /var/lib/mysql
mysqld --initialize
# start up
systemctl start mysqld
# Set automatic startup
systemctl enable mysqld
systemctl daemon-reload
Note that when I start the MySQL service, it prompts:
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
I think it may have something to do with the installation of MySQL in my system. Solution:
chown mysql:mysql -R /var/lib/mysql
At startup:
service mysqld start
View running status:
systemctl status mysqld
Works perfectly:
mysqladmin --version
Reason: The password will not be set by default after the installation of MySQL, we need to set it ourselves
mysqladmin -u root password "Your password"
I am really a child who is favored by God. I encountered a problem with setting a password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Generally, this error is caused by a wrong password. The natural solution is to reset the password.
The solution is as follows:
Stop the mysql database: systemctl stop mysqld
Start MySQL with the following command, and start it without checking permissions:
mysqld --skip-grant-tables &
If an error is reported, this can be used:
mysqld --user=root --skip-grant-tables &Log in to mysql: mysql -u root -p or mysql
Update root password:
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Prompt when changing the password:
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
Solution:
Flush privileges: flush privileges;Refresh privileges: flush privileges;
Exit mysql: exit or quit
Log in to mysql again as root user
mysql -uroot -p
Enter password: <Enter the new password 123456>
mysql -u root -p
Then enter the password and press Enter to enter the MySQL database
https://jingyan.baidu.com/article/363872ec3263236e4ba16f07.html
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
UPDATE user SET `Host`='%' WHERE `User`='root' LIMIT 1;
flush privileges;
Recommended Posts