Missing /var/lib/mysql/mysql.sock file

前端 未结 8 1144
忘掉有多难
忘掉有多难 2021-02-18 14:22

I\'m trying to access mysql and when I run the mysql command, I get the following.

[root@ip-10-229-65-166 tpdatabase-1.8.0.28356]# mysql

ERR

相关标签:
8条回答
  • 2021-02-18 14:52

    You need to install the server package:

    sudo yum install mysql-server
    

    After installation, you have to start the service:

    sudo service mysqld start
    
    0 讨论(0)
  • 2021-02-18 14:57

    Make sure you have privileges to access the /var/lib/mysql/mysql.sock file. And if you still get the error, create a default my.cnf file with

    [client]
    socket = /path/to/mysql/data/mysql.sock
    [mysqld]
    server-id = 2
    socket = /path/to/mysql/data/mysql.sock
    port = 4000 #any port you wish
    basedir = /path/to/mysql
    datadir = /path/to/mysql/data
    

    and initialize the database again. Make sure you give --defaults-file=/path/to/mysql/my.cnf when you initialize. If you get error saying files exist in /path/to/mysql/data, remove them and try again. Once done, when you run mysql also, give --defaults-file=/path/to/mysql/my.cnf. Should work.

    0 讨论(0)
提交回复
热议问题