我有一个新的MariaDB安装,没有密码。通过mysql连接对根用户有效,不需要密码,也不需要任何其他参数。$ sudo -i rootWelcome to the MariaDB monitor. Commands end with ; or \g.Server version: 10.2.21-MariaDB-log MariaDB Server 但是使用python MySQLdb库连接到套接字失败: $ python
Python 2.7.5
cloud_sql_instances: coral-heuristic-215610:us-central1:db-basic-1- name: lxml- name: MySQLdb现在,当我尝试从应用程序连接(在Cloud中)时,出错:
OperationalError: (2002, 'Can\'t connect to local MySQL server through socket--+----------------------+----------------
mysql_exceptions.OperationalError:(2002年,“无法通过socket '/var/run/mysqld/mysqld.sock‘(2)”连接到本地MySQL服务器)在安装MySQL和XAMPP之后,我用PyCharm编写了以下代码:
db = MySQLdb.connect("localhost","yara","yara",&q