我正在尝试通过 SSH 进行数据库管理Bitnami 的 WordPress 多层堆栈/ 具体来说,我想要导出并进行初始导入(尽管我可能只会创建一个新的数据库)。
当我运行以下命令时,出现以下错误:
命令: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
(my-medium、my-small 和 my-large 之间有什么区别)?
输出:
# 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
不存在。
命令:mysql.server start
(但如果我的 WP 网站正在运行,这不是已经运行了吗?)
输出: -bash: mysql.server: command not found
我搜索了一下,发现了MariaDB 关于 2002 错误的文档,但我似乎没有相同的 .conf 文件(我也不知道在哪里查找)
...从这里我不知道要去哪里,我只通过 shell 进行了有限的数据库管理。
简洁的问题:
- 如何导出我的数据库而不获取2002 错误?
- 我如何覆盖/更新我的数据库?
如能得到任何帮助我将非常感激,并提前致谢!
答案1
Bitnami 的人来帮忙了。我连接到了错误的主机。
查找主机:
sudo cat /opt/bitnami/wordpress/wp-config.php | grep 'DB_HOST'
导出:
mysqldump -h provisioner-peer -u root -p bitnami_wordpress > bitnami_wordpress.sql