как получить доступ к mysql в консоли

Я установил mysql один с xampp и выполняющий все сервисы успешно, но когда я пытаюсь войти в mysql сервер с помощью mysql-клиента, он дает следующую ошибку.

user@user-pc:~$ sudo /opt/lampp/lampp startmysql 
XAMPP: Starting MySQL...already running.
user@user-pc:~$ mysql -h localhost -u root -p 
Enter password:  
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

как я могу зафиксировать эту ошибку

0
задан 20 July 2015 в 21:36

1 ответ

Я могу зафиксировать выше проблемы путем простой замены/opt/lampp/etc/my.cnf, файл к/etc/mysql/my.cnf

1) Сначала копируют/etc/mysql/my.cnf некоторым, где, если некоторое дело идет неправильно

user@user:~$ cp /etc/mysql/my.cnf ~/Desktop/

2) Затем копия/etc/mysql/my.cnf файл к/etc/mysql /

user@user:~$ sudo cp /opt/lampp/etc/my.cnf /etc/mysql/

3) Перезапуск, компьютер

4) Запускает lampp сервер

user@user:~$ sudo /opt/lampp/lampp start

5) Затем, mysql-клиент запустит в консоли без любых ошибок

user@user:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.24 Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

я сделанный это в Ubuntu 14.04

0
ответ дан 29 July 2019 в 22:46

Другие вопросы по тегам:

Похожие вопросы: