preface
This is my first attempt to install mysql on the server. I have recorded and summarized the problems encountered. I hope I can prompt people who encounter the same problems. If I can't solve your problem, continue to refuel, and I will be able to find a solution. Du Niang is forced
Here will be a blog for reference. Thank you for sharing and helping me solve the problem
Finally solve my problem Blog
Install the software to the server for my reference Blog
Download the mysql installation package to the server
Download path: https://dev.mysql.com/downloads/mysql/
At the beginning, I downloaded 8.0.25 according to the process, which is the latest version at this time, but there were many problems. I finally changed it to 5.7.34
Problems:
root@iZwz9eytry3trsn5w5dfmvZ mysql]# rpm -ivh mysql-community-libs-8.0.25-1.el8.x86_64.rpm Warning: mysql-community-libs-8.0.25-1.el8.x86_64.rpm: head V3 DSA/SHA1 Signature, secret key ID 5072e1f5: NOKEY Error: dependency detection failed: libc.so.6(GLIBC_2.28)(64bit) cover mysql-community-libs-8.0.25-1.el8.x86_64 need libcrypto.so.1.1()(64bit) cover mysql-community-libs-8.0.25-1.el8.x86_64 need libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) cover mysql-community-libs-8.0.25-1.el8.x86_64 need libcrypto.so.1.1(OPENSSL_1_1_1)(64bit) cover mysql-community-libs-8.0.25-1.el8.x86_64 need libssl.so.1.1()(64bit) cover mysql-community-libs-8.0.25-1.el8.x86_64 need libssl.so.1.1(OPENSSL_1_1_0)(64bit) cover mysql-community-libs-8.0.25-1.el8.x86_64 need libssl.so.1.1(OPENSSL_1_1_1)(64bit) cover mysql-community-libs-8.0.25-1.el8.x86_64 need libstdc++.so.6(CXXABI_1.3.9)(64bit) cover mysql-community-libs-8.0.25-1.el8.x86_64 need libstdc++.so.6(GLIBCXX_3.4.20)(64bit) cover mysql-community-libs-8.0.25-1.el8.x86_64 need libstdc++.so.6(GLIBCXX_3.4.21)(64bit) cover mysql-community-libs-8.0.25-1.el8.x86_64 need mysql-community-client-plugins = 8.0.25-1.el8 cover mysql-community-libs-8.0.25-1.el8.x86_64 need
I went to download the installation package. I found the download path and and downloaded it, but I won't install it, and there will be too many problems installing the latest version. Now there is no tutorial on the Internet to help solve the problem. The only thing I found about solving this problem Blog , it can be used for reference. Anyway, I don't have any operation. It feels a little too simple
Download this installation package glibc_ Compressed packages of version 2.28 or higher can go here route
Then I abandoned 8.0.25 and threw myself into the embrace of 5.7.34. Don't say I don't have the spirit of exploration. What I care about is that I now have a usable mysql on the server. If there is enough time, let's talk about it at that time.
Install path 8.0.25 of 5.7.34. If you can solve the dependency problem of starting installation, the following path should be consistent
Download installation package
Click download from the top figure to enter this page
cd /home/admin/mysoftware Downloaded installation package wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.34-1.el7.x86_64.rpm-bundle.tar
wget Also post a detailed explanation of the use of
Unzip the compressed file to opt
The significance of putting software under opt
mkdir -p /opt/module/mysql Create folder recursively [root@iZwz9eytry3trsn5w5dfmvZ myselfFile]# tar -xvf mysql-5.7.34-1.el7.x86_64.rpm-bundle.tar -C /opt/module/mysql mysql-community-client-5.7.34-1.el7.x86_64.rpm mysql-community-common-5.7.34-1.el7.x86_64.rpm mysql-community-devel-5.7.34-1.el7.x86_64.rpm mysql-community-embedded-5.7.34-1.el7.x86_64.rpm mysql-community-embedded-compat-5.7.34-1.el7.x86_64.rpm mysql-community-embedded-devel-5.7.34-1.el7.x86_64.rpm mysql-community-libs-5.7.34-1.el7.x86_64.rpm mysql-community-libs-compat-5.7.34-1.el7.x86_64.rpm mysql-community-server-5.7.34-1.el7.x86_64.rpm mysql-community-test-5.7.34-1.el7.x86_64.rpm
Switch to this directory to install these packages
Here can be used for reference article To check whether there are corresponding mysql and mariadb packages in the current system
I installed it successfully Why detect mariadb
If the version is not the same as the one you downloaded and installed this time, delete it and use yum. No – > install it
[root@iZwz9eytry3trsn5w5dfmvZ myselfFile]# rpm -qa | grep mysql mysql-community-libs-5.7.34-1.el7.x86_64 mysql-community-common-5.7.34-1.el7.x86_64 mysql-community-server-5.7.34-1.el7.x86_64 mysql-community-client-5.7.34-1.el7.x86_64 mysql-community-libs-compat-5.7.34-1.el7.x86_64 [root@iZwz9eytry3trsn5w5dfmvZ myselfFile]# rpm -qa | grep mariadb [root@iZwz9eytry3trsn5w5dfmvZ myselfFile]#
Using yum , I think it should be used frequently
yum list installed Show the installed software or plug-ins, and then people will arrange them in alphabetical order and find them. If you want to specify a file yum list installed | grep mysql yum list View the software packages that can be installed and suggest grep I don't know why some can't be found. Don't care about these details yum install Full name of software installation yum remove Full name of the software uninstall package yum deplist tomcat The dependency of the installation package should be useful Update installation package yum update Update all yum update tomcat Update the specified installation package yum check-update Check for installation packages that need to be updated
After all these are done, do you have the following results? Then I'll go on
It doesn't matter if the number is wrong; As long as you don't lack the package installed this time, you should have no problem
install the mysql-community-server, mysql-community-client, mysql-community-libs, mysql-community-common, and mysql-community-libs-compat packages to get a functional
[root@iZwz9eytry3trsn5w5dfmvZ myselfFile]# ll /opt/module/mysql/ Total consumption 531116 -rw-r--r-- 1 7155 31415 26597364 3 June 27 00:49 mysql-community-client-5.7.34-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 317444 3 June 27 00:49 mysql-community-common-5.7.34-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 4119104 3 June 27 00:49 mysql-community-devel-5.7.34-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 47479092 3 June 27 00:49 mysql-community-embedded-5.7.34-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 23264364 3 June 27 00:49 mysql-community-embedded-compat-5.7.34-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 131605536 3 June 27 00:49 mysql-community-embedded-devel-5.7.34-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 2472844 3 June 27 00:49 mysql-community-libs-5.7.34-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 1262704 3 June 27 00:49 mysql-community-libs-compat-5.7.34-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 181833876 3 June 27 00:50 mysql-community-server-5.7.34-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 124888148 3 June 27 00:50 mysql-community-test-5.7.34-1.el7.x86_64.rpm
Run the following command to change the installation sequence. It should not be a big problem
rpm -ivh mysql-community-common-8.0.16-2.el7.x86_64.rpm rpm -ivh mysql-community-libs-8.0.16-2.el7.x86_64.rpm --force --nodeps rpm -ivh mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm rpm -ivh mysql-community-client-8.0.16-2.el7.x86_64.rpm --force --nodeps rpm -ivh mysql-community-server-8.0.16-2.el7.x86_64.rpm --force --nodeps
At this stage, do you think it's good? Wrong. I've been struggling for an hour until the final success
systemctl start mysqld open mysql Why one more d,I don't know either systemctl restart mysqld restart mysql [root@iZwz9eytry3trsn5w5dfmvZ mysql]# systemctl start mysqld.service Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details. [root@iZwz9eytry3trsn5w5dfmvZ mysql]# systemctl status mysqld.service ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: deactivating (final-sigterm) (Result: exit-code) Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 19471 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE) Process: 19448 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) CGroup: /system.slice/mysqld.service └─19474 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid 6 June 24-17:59:25 iZwz9eytry3trsn5w5dfmvZ systemd[1]: mysqld.service holdoff time over, scheduling restart. 6 June 24-17:59:25 iZwz9eytry3trsn5w5dfmvZ systemd[1]: Stopped MySQL Server. 6 June 24-17:59:25 iZwz9eytry3trsn5w5dfmvZ systemd[1]: Starting MySQL Server... 6 June 24-17:59:25 iZwz9eytry3trsn5w5dfmvZ mysqld_pre_systemd[19448]: 2021-06-24T09:59:25.433799Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is ...ails). 6 June 24-17:59:25 iZwz9eytry3trsn5w5dfmvZ mysqld_pre_systemd[19448]: 2021-06-24T09:59:25.435299Z 0 [ERROR] --initialize specified but the data directo...rting. 6 June 24-17:59:25 iZwz9eytry3trsn5w5dfmvZ mysqld_pre_systemd[19448]: 2021-06-24T09:59:25.435330Z 0 [ERROR] Aborting 6 June 24-17:59:25 iZwz9eytry3trsn5w5dfmvZ systemd[1]: mysqld.service: control process exited, code=exited status=1
a key
grep 'password' /var/log/mysqld.log No password was found in this step. That's all 2021-06-24T10:06:36.924953Z 0 [Note] Shutting down plugin 'sha256_password' 2021-06-24T10:06:36.924956Z 0 [Note] Shutting down plugin 'mysql_native_password' The last one is missing 2021-06-24T10:06:38.545271Z 1 [Note] A temporary password is generated for root@localhost: hRhSh>kod6la I can't get it hRhSh>kod6la Temporary password, you can't log in naturally mysql -uroot -p
The service works, but I can't log in and get a temporary password. It's very difficult – > Remember this
terms of settlement
[root@iZwz9eytry3trsn5w5dfmvZ mysql]# cat /etc/my.cnf # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M datadir=/var/lib/mysql ###Look here, look here < --- / data plus socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
vim command look green hand ah
No, I don't teach
Finally, I finally found my temporary password. I went in -- > it's not the end
After you go in, can't you use any commands, and you've been prompted to change your password
show databases; Tips ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
End -- > alter user() identified by "password tihuan";
The whole article is like a running account. It's operated according to my memory. I hope it can help you. If you can't help, don't ask me. Ask Du Niang. If Du Niang can't find it, I can't help it. It depends on how you change. That's it for the time being. I'll continue my Exploratory Journey.