mysql->initialize Database"; then enter the password; and finally re-initialize mysql."/> mysql->initialize Database"; then enter the password; and finally re-initialize mysql.">
The solution to the problem that mysql8.0 does not have a port: first directly enter "System Preferences->mysql->initialize Database"; then enter the password; and finally re-initialize mysql.
Recommendation: "mysql video tutorial"
mac solves the problem of MySql (8.0.20) after startup. The port is 0 , unable to connect to Workbench problem
Problem 1: my.cnf is not set
If the my.cnf configuration is not set, there will be an account and password login failure
MySql cannot be started or closed in the system preference configuration
Solve the configuration of my.cnf to /etc/my.cnf
Problem 2: Check the port number is 0
mysql> show global variables like ‘port’; ±--------------±------+ | Variable_name | Value | ±--------------±------+ | port | 0 | ±--------------±------+ mysql> SHOW VARIABLES LIKE ‘skip_networking’; ±----------------±------+ | Variable_name | Value | ±----------------±------+ | skip_networking | OFF | ±----------------±------+
Let’s talk about the solution first:
Go directly to the system preferences-->mysql-->initialize Database, then enter the password and re-initialize mysql
1
Result:
±--------------±------+ | Variable_name | Value | ±--------------±------+ | port | 3306 | ±--------------±------+
Tried method, you can also try
First check SHOW VARIABLES LIKE 'skip_networking'; if skip_networking = On is reported, your mysqld does not have a network Started if supported (resulting in a value of 0 in the port system variable).
If this is the case you will most likely have to check mysqld's init script, most likely under /etc/init.d/mysql, search for --skip-networking there and comment it out (remove) this section. After completing this process, you must restart mysqld.
Or whether skip_networking is enabled in my.cnf, if so, comment it out.
Normaly there is no need to explicitly set port 3306, because 3306 is the default port mjysqld listens on.
There is another solution:
/System/Library/LaunchDaemons/org.mysql.mysqld <key>ProgramArguments</key> <array> <string>/opt/local/lib/mariadb-10.1/bin/mysqld</string> <string>--skip_networking=0</string> <string>--socket=/opt/local/var/run/mariadb-10.1/mysqld.sock</string> <string>--user=mysql</string> <string>--port=3306</string> <string>--datadir=/opt/local/var/db/mariadb-10.1</string> <string>--pid-file=/opt/local/var/run/mariadb-10.1/dns.local.pid</string> </array>
The above is the detailed content of How to solve the problem of no port in mysql8.0. For more information, please follow other related articles on the PHP Chinese website!