Mac-can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)

Source: Internet
Author: User
Tags rollback

In the terminal input MySQL, the result appears

macdemacbook-pro:~ mac$ alias mysql=/usr/local/mysql/bin/mysqlmacdemacbook-pro:~2002 ( HY000): Can'/tmp/mysql.sock'  (2)

Search the Internet for many ways, not good, and then query the official documents

Http://dev.mysql.com/doc/refman/5.7/en/can-not-connect-to-server.html

The following writes

Here is some reasons the Can‘t connect to local MySQL server error might occur:

    • mysqld is isn't running on the local host. Check your operating system ' s process list to ensure, the mysqld process is present.

    • 。。。

I didn't think the first one would fit, and then I tried typing mysqld.

Results:

macdemacbook-pro:bin mac$ mysqld2018- to-10t07: at: in.997151Z0[Warning] TIMESTAMP withImplicitDEFAULT value isDeprecated. --explicit_defaults_for_timestamp server option (see documentation forMore details).2018- to-10t07: at: in.997492Z0[Note]--secure-file-priv is SetTo NULL. Operations related to importing and exporting data is disabled2018- to-10t07: at: in.997557Z0[Note] Mysqld (mysqld5.7. A) starting asProcess33939 ...2018- to-10t07: at: -.003105Z0[Warning] Setting lower_case_table_names=2Because file system for/usr/local/var/mysql/ is  Caseinsensitive2018- to-10t07: at: -.004893Z0[Note] innodb:mutexes and rw_locks use GCC atomic builtins2018- to-10t07: at: -.004919Z0[Note] Innodb:usesEventmutexes2018- to-10t07: at: -.004926Z0[Note] INNODB:GCC Builtin __atomic_thread_fence () isUsed forMemory Barrier2018- to-10t07: at: -.004932Z0[Note] innodb:compressed Tables Use Zlib1.2.32018- to-10t07: at: -.005337Z0[Note] Innodb:number of Pools:12018- to-10t07: at: -.005498Z0[Note] innodb:using CPU CRC32 Instructions2018- to-10t07: at: -.007117Z0[Note] Innodb:initializing buffer pool, total size = 128M, instances =1, Chunk size =128M2018- to-10t07: at: -.018796Z0[Note] innodb:completed initialization of buffer pool2018- to-10t07: at: -.035212Z0[Note] Innodb:highest supported file format isBarracuda.2018- to-10t07: at: -.051578Z0[Note] Innodb:creating shared tablespace forTemporary Tables2018- to-10t07: at: -.051764Z0[Note] innodb:setting file'./IBTMP1'Size to AMB. Physically writing the file full; Please wait ...2018- to-10t07: at: -.065007Z0[Note] Innodb:file'./IBTMP1'Size isNow AMB.2018- to-10t07: at: -.065856Z0[Note] InnoDB: theRedo rollback segment (s) found. theRedo rollback Segment (s) is active.2018- to-10t07: at: -.065868Z0[Note] InnoDB: +non-Redo rollback Segment (s) is active.2018- to-10t07: at: -.066135Z0[Note] Innodb:waiting forpurge to start2018- to-10t07: at: -.121419Z0[Note] InnoDB:5.7. AStarted Log sequence Number25516742018- to-10t07: at: -.121762Z0[Note] Innodb:loading buffer Pool (s) from/usr/local/var/mysql/Ib_buffer_pool2018- to-10t07: at: -.122048Z0[Note] Plugin'Federated'  isdisabled.2018- to-10t07: at: -.133391Z0[Note] Innodb:buffer Pool (s) load completed at180510  the: at: -2018- to-10t07: at: -.134352Z0[Note] Found Ca.pem, Server-cert.pem and Server-key.peminchData directory. Trying to enable SSL supportusingthem.2018- to-10t07: at: -.134366Z0[Note] Skipping generation of SSL certificates asCertificate files are presentinchData directory.2018- to-10t07: at: -.135842Z0[Warning] CA Certificate Ca.pem isSelf signed.2018- to-10t07: at: -.135903Z0[Note] Skipping generation of RSA key pair asKey files are presentinchData directory.2018- to-10t07: at: -.142139Z0[Note] Server hostname (bind-address):'127.0.0.1'; Port33062018- to-10t07: at: -.142191Z0[Note]-'127.0.0.1'resolves to'127.0.0.1';2018- to-10t07: at: -.142330Z0[Note] Server socket created on IP:'127.0.0.1'.2018- to-10t07: at: -.195770Z0[Note] Event scheduler:loaded0Events2018- to-10t07: at: -.195949Z0[Note] Mysqld:ready forconnections. Version:'5.7.22'Socket'/tmp/mysql.sock'Port3306Homebrew

Waiting for a whole bunch of bugs and stuff, and finally quitting.

Finally, the right approach:

macdemacbook-pro:~mac$ sudo mysqld_safepassword:logging to'/usr/local/var/mysql/macdemacbook-pro.local.err'.2018- to-10t07: -: A.6NZ Mysqld_safe starting mysqld daemon with databases from/usr/local/var/MySQL2018- to-10t07: -: A.6NZ Mysqld_safe Mysqld fromPID file/usr/local/var/mysql/macdemacbook-Pro.local.pid Endedmacdemacbook-pro:~mac$ Mysqlerror1045(28000): Access denied forUser'mac'@'localhost'(usingPassword:no)

Then the MYSQLD service is running.

At this point, you can finally open MySQL

Mac-can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.