尝试在Bitnami的WordPress多层堆栈中导入/导出MariaDB数据库时出现2002代码错误

时间:2018-09-12 14:32:26

标签: mysql amazon-web-services mariadb

我正在尝试通过SSH对Bitnami's WordPress Multi-tier Stack /进行数据库管理/具体来说,我想导出并进行初始导入(尽管我可能只会创建一个新数据库)。

运行以下命令时,出现以下错误:


命令:mysqldump -u root -p bitnami_wordpress > bitnami_wordpress.sql

输出:mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/opt/bitnami/mariadb/tmp/mysql.sock' (2)" when trying to connect

这还会在我的主目录中创建一个0B SQL文件。


命令:mysqladmin -u root -p status(我输入密码)

输出:

mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket . 
'/opt/bitnami/mariadb/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: 
'/opt/bitnami/mariadb/tmp/mysql.sock' exists!

命令:cd /opt/bitnami/mariadb/ + ls

输出:

bin                 CREDITS            include         licenses   README-wsrep
COPYING             data               INSTALL-BINARY  plugin     sbin
COPYING.thirdparty  EXCEPTIONS-CLIENT  lib             README.md  share

命令:sudo find . -name mysql

输出:

./root/.nami/components/com.bitnami.mysql-client/lib/databases/mysql
./root/.nami/components/com.bitnami.mysql-client/lib/handlers/databases/mysql
./root/.nami/components/com.bitnami.libphp/lib/databases/mysql
./root/.nami/components/com.bitnami.libphp/lib/handlers/databases/mysql
./root/.nami/components/com.bitnami.wordpress/lib/databases/mysql
./root/.nami/components/com.bitnami.wordpress/lib/handlers/databases/mysql
./root/.nami/components/com.bitnami.php/lib/databases/mysql
./root/.nami/components/com.bitnami.php/lib/handlers/databases/mysql
./root/.nami/components/com.bitnami.apache/lib/databases/mysql
./root/.nami/components/com.bitnami.apache/lib/handlers/databases/mysql
./root/.nami/components/com.bitnami.mariadb/lib/databases/mysql
./root/.nami/components/com.bitnami.mariadb/lib/handlers/databases/mysql
./opt/bitnami/mysql
./opt/bitnami/mysql/bin/mysql
./opt/bitnami/mariadb/include/mysql
./opt/bitnami/mariadb/include/mysql/server/mysql
./opt/bitnami/mariadb/include/mysql/mysql
./opt/bitnami/mariadb/bin/mysql
./usr/share/bash-completion/completions/mysql

命令:

find /opt/bitnami/mysql/ -name "*.cnf" 

输出:没什么

find /opt/bitnami/mariadb/ -name "my.cnf"

输出:

/opt/bitnami/mariadb/share/my-medium.cnf
/opt/bitnami/mariadb/share/my-small.cnf
/opt/bitnami/mariadb/share/my-large.cnf
/opt/bitnami/mariadb/share/my-innodb-heavy-4G.cnf
/opt/bitnami/mariadb/share/my-huge.cnf
/opt/bitnami/mariadb/share/wsrep.cnf

命令:nano /opt/bitnami/mariadb/share/my-medium.cnf (我的中号,我的小号和我的大号之间有什么区别)?

输出:

# The following options will be passed to all MariaDB clients
[client]
#password       = your_password
port            = 3306
socket          = /opt/bitnami/mariadb/tmp/mysql.sock

注意:/opt/bitnami/mariadb/tmp/mysql.sock不存在。


我已经戳了一下,发现MariaDB's Documentation about 2002 errors,但是我似乎没有相同的.conf文件(也不知道在哪里查找)

...从这里开始,我不知道要去哪里,我只通过shell进行了有限的数据库管理。

简明的问题:

  1. 如何在不获取2002 error的情况下导出数据库?
  2. 如何覆盖/更新数据库?

任何帮助将不胜感激,并在此先感谢!

1 个答案:

答案 0 :(得分:0)

Bitnami的人们来了。我连接到错误的主机。

查找主机: sudo cat /opt/bitnami/wordpress/wp-config.php | grep 'DB_HOST'

要导出:

mysqldump -h provisioner-peer -u root -p bitnami_wordpress > bitnami_wordpress.sql