Home > Database > Mysql Tutorial > body text

How to solve the problem of no port in mysql8.0

藏色散人
Release: 2020-10-30 16:53:28
Original
5776 people have browsed it

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.

How to solve the problem of no port in mysql8.0

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 |
±----------------±------+
Copy after login

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 |
±--------------±------+
Copy after login

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!