MySQL` starts with a port being listened to, but the service is not fully started. backgroundWhen MySQL starts, it will initialize the database for the first time. After MySQL is fully started, it will initialize the database for the second time. The first time you initialize the database, use --skip-networking (this option disables MySQL's TCP/IP connection method) to start MySQL for initialization. After initialization is complete, restart MySQL with the --skip-networking option turned off. The second time you initialize the database, you will set the root password. How to determine whether MySQL has been fully startedTry to actively connect to MySQL. A successful connection indicates that the service has been fully started. mysql -hlocalhost -P3306 -uroot ACCIDENTSince the above judgment method uses socket to connect to the database, but the first time only prohibits MySQL's TCP/IP connection method, Therefore, the second database initialization may have been performed before the first database initialization was completed. The second database initialization sets the root password earlier than the first database initialization, which causes the first initialization to fail because it cannot connect to the database. Finally, the TCP/IP connection method was not enabled and the application could not connect to the database. First modificationUse -h127.0.0.1 to connect to the database mysql -h127.0.01 -P3306 -uroot However, since the host of the root user is set to localhost, 127.0.0.1 is not allowed to connect, and the first modification fails. Second revisionwait-for-it.sh 127.0.0.1:3306 --timeout=300 mysql -hlocalhost -P3306 -uroot wait-for-it.sh is used to detect whether 127.0.0.1:3306 is in the listening state. If it is, it means that the first database initialization is completed. Then use localhost to try to connect to the database. Original link: k8scat.com/posts/wait-… SummarizeThis is the end of this article about accidents caused by MySQL startup. For more information about accidents caused by MySQL startup, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Sitemesh tutorial - page decoration technology principles and applications
>>: HTML uses marquee to achieve text scrolling left and right
Table of contents Tutorial Series 1. Introduction...
1. Achieve the effect 2 Knowledge Points 2.1 <...
Table of contents 1. Detailed syntax of entires()...
Xiaobai records the installation of vmtools: 1. S...
Table of contents 1. Introduction to NFS 2. NFS C...
MySQL allows you to create multiple indexes on th...
Table of contents 1. Simple to use 2. Use DISTINC...
1. Simple configuration of nginx's dynamic an...
In previous blog posts, I have been focusing on so...
In HTML, the Chinese phrase “學好好學” can be express...
"Page screenshot" is a requirement ofte...
Preface As Linux operation and maintenance engine...
Preface I'm currently working on the data ana...
Table of contents About FastDFS 1. Search for ima...
Let's take an example: The code is very simple...