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
1. flex-direction: (direction of element arrangem...
This question originated from a message on Nugget...
Table of contents 1. Pre-analysis 1. Variable pre...
After I analyzed the Taobao details page last time...
Table of contents Union query 1. Query the ID and...
Table of contents Preface 1. Common bug fixes in ...
Transactions in MySQL are automatically committed...
This article describes the MySQL user rights mana...
1. Brief introduction of the event An event is a ...
Table of contents Preface 1. Tomcat class loader ...
Introduction to NFS NFS (Network File System) is ...
Written in front I have been writing a special to...
Result: Implementation code: Need to be used with...
Why beautify the file control? Just imagine that a...
Because I wrote the word transition incorrectly i...