首页 小组 文章 搜索 用户

Mailcow邮件系统重置密码(包括MYSQL)

2020-03-10 12:31:49
0
421
mailcow管理员帐户
将mailcow admin重置为admin:moohoo。较旧的mailcow:dockerized安装程序可能会mailcow-reset-admin.sh在其mailcow根目录(mailcow_path)中找到。
cd mailcow_path
./helper-scripts/mailcow-reset-admin.sh
重置MySQL密码
通过运行停止堆栈docker-compose stop。
当容器停止时,运行以下命令:
docker-compose run --rm --entrypoint '/bin/sh -c "gosu mysql mysqld --skip-grant-tables & sleep 10 && mysql -hlocalhost -uroot && exit 0"' mysql-mailcow
1.查找数据库名称
# source mailcow.conf
# docker-compose exec mysql-mailcow mysql -u${DBUSER} -p${DBPASS} ${DBNAME}
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mailcow_database   | <=====
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
2.复位一个或多个用户
“ password”和“ authentication_string”都存在。当前使用“密码”,但最好同时设置两者。

MariaDB [(none)]> SELECT user FROM mysql.user;
+--------------+
| user         |
+--------------+
| mailcow_user | <=====
| root         |
+--------------+
2 rows in set (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('gotr00t'), password = PASSWORD('gotr00t') WHERE User = 'root';
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('mookuh'), password = PASSWORD('mookuh') WHERE User = 'mailcow' AND Host = '%';
MariaDB [(none)]> FLUSH PRIVILEGES;
删除两因素身份验证
这项工作类似于重置MySQL密码,现在我们无需连接MySQL CLI即可在主机上进行密码设置:
source mailcow.conf
docker-compose exec mysql-mailcow mysql -u${DBUSER} -p${DBPASS} ${DBNAME} -e "DELETE FROM tfa WHERE username='YOUR_USERNAME';"

评论