Home>

This is a local event. MAMP.

mysql server 3306

Run terminal

$mysql -uroot -proot
mysql>

Sequel pro standard
127.0.0.1
root
root
3306
Run with.

Failed to connect to host 127.0.0.1 or request timed out.
Please make sure that the address has the necessary permissions, or increase the connection timeout (currently 10 seconds).
MySQL response: Can't connect to MySQL server on '127.0.0.1' (61)

However, you can connect via a socket.

mysql server 8889

Try changing the port to 8889

Run terminal

$mysql -uroot -proot
mysql>

Sequel pro standard
127.0.0.1
root
root
8889
Run with.

Connection succeeded
If i change the

port to 8889, you can connect to the problem, but I want to use the default 3306.

Survey
$sudo lsof -i: 3306
$sudo lsof -i: 8889
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 34681 XXXXXXX 29u IPv6 0x5b3f8c7ad143662f 0t0 TCP *: ddi-tcp-2 (LISTEN)

I don't know much about it, so I don't know much about it.

How can I use 3306? . .

I have a similar question
https://www.tutorialfor.com/go.php?id=112354

I'm using laravel, but I can usephp artisan migrate.

$php artisan migrate
   Illuminate \ Database \ QueryException: SQLSTATE [HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations)
  at /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660 | // If an exception occurs when attempting to run a query, we'll format the error
    661 | // message to include the bindings with SQL, which will make this exception a
    662 | // lot more helpful to the developer instead of just the database's errors.
    663 | catch (Exception $e) {
  >664 | throw new QueryException (665 | $query, $this->prepareBindings ($bindings), $e
    666 |);
    667 |
    668 |
  Exception trace:
  1 PDOException: :( "SQLSTATE [HY000] [2002] Connection refused")
      /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
  2 PDO :: __ construct ("mysql: host = 127.0.0.1;port = 3306;dbname = laravel", "root", "root", [])
      /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
  Please use the argument -v to see more details.</Code></pre>
<p>If i use 3306 via a socket, the client software will connect, but you can get another error with laravel.<br />
It's like using a socket because you can't get addresses.</p>
<pre><code>$php artisan migrate
   Illuminate \ Database \ QueryException: SQLSTATE [HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations)
  at /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660 | // If an exception occurs when attempting to run a query, we'll format the error
    661 | // message to include the bindings with SQL, which will make this exception a
    662 | // lot more helpful to the developer instead of just the database's errors.
    663 | catch (Exception $e) {
  &gt;664 | throw new QueryException (
    665 | $query, $this-&gt;prepareBindings ($bindings), $e
    666 |);
    667 |
    668 |
  Exception trace:
  1 PDOException: :( "PDO :: __ construct (): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known")
      /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
  2 PDO :: __ construct ("mysql: host = mysql;port = 3306;dbname = laravel", "root", "root", [])
      /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
  Please use the argument -v to see more details.</Code></pre>
<p>8889 can be used to connect client software, and laravel can't work.</p>
<pre><code>$php artisan migrate
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2018_08_31_002515_create_bookmarks_table
Migrated: 2018_08_31_002515_create_bookmarks_table

I'd like to use 3306 normally. What can I think of?

I use docker in another project, but all containers are closed.

The following meaning is that 3306 is not used, so I recognize that there is no port conflict, but is it there first?

$sudo lsof -i: 3306
$sudo lsof -i: 8889
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 34681 XXXXXXX 29u IPv6 0x5b3f8c7ad143662f 0t0 TCP *: ddi-tcp-2 (LISTEN)

Why are you able to get there even if there is no conflict? . .

  • Answer # 1

    Okay, after restarting my pc, I got the client, command and laravel.

    MG-MacBook-Pro: blog MacPRO-N-GOTO $sudo lsof -i: 8889
    Password:
    MG-MacBook-Pro: blog MacPRO-N-GOTO $
    MG-MacBook-Pro: blog MacPRO-N-GOTO $sudo lsof -i: 3306
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    Sequel 331 MacPRO-N-GOTO 16u IPv4 0x870b1f27a8dfb09b 0t0 TCP localhost: 49591->localhost: mysql (ESTABLISHED)
    Sequel 331 MacPRO-N-GOTO 17u IPv4 0x870b1f27a8eb89fb 0t0 TCP localhost: 49592->localhost: mysql (ESTABLISHED)
    mysqld 1342 MacPRO-N-GOTO 35u IPv6 0x870b1f278cc410d3 0t0 TCP *: mysql (LISTEN)
    mysqld 1342 MacPRO-N-GOTO 51u IPv6 0x870b1f27b153f913 0t0 TCP localhost: mysql->localhost: 49591 (ESTABLISHED)
    mysqld 1342 MacPRO-N-GOTO 71u IPv6 0x870b1f27b153fed3 ​​0t0 TCP localhost: mysql->localhost: 49592 (ESTABLISHED)