简体   繁体   English

通过require ssl锁定phpmyadmin

[英]Locked out of phpmyadmin by require ssl

I clicked "require ssl" in phpmyadmin on my server and it locked me out. 我在服务器上的phpmyadmin中单击“ require ssl”,它将我锁定了。 I've searched everywhere for any file I can change to reverse this, but all the old methods have been discontinued in the newer versions of phpmyadmin (4.6+). 我到处搜索了可以更改的任何文件以扭转这种情况,但是新版本的phpmyadmin(4.6+)中不再使用所有旧方法。 I have scoured through all the files I could get my hands on, but to no avail. 我仔细检查了所有可以使用的文件,但无济于事。 Does anyone have any ideas on this? 有人对此有任何想法吗?

This may not be exactly for your version of mysql but one simple way to solve this on mariadb/mysql is to enable ssl connections on your server. 这可能不完全适合您的mysql版本,但是在mariadb / mysql上解决此问题的一种简单方法是在服务器上启用ssl连接。 As a side effect, it will render your server more secure if you force users to use SSL... The way to do this is to: 副作用是,如果您强制用户使用SSL,它将使您的服务器更安全。实现此目的的方法是:

1) Create a certificate for your server if not already done. 1)为您的服务器创建证书(如果尚未完成的话)。 There are lots of site to explain how to do this. 有很多站点来解释如何执行此操作。 http://www.openssl.org would be a good start. http://www.openssl.org将是一个好的开始。

2) Modify the mariadb configuration /etc/mysql/my.cnf for the server to point to your certificate: 2)修改服务器的mariadb配置/etc/mysql/my.cnf以指向您的证书:

sudo vi /etc/mysql/my.cnf

And add/uncomment the following lines (and change the path to the SSL files): 并添加/取消注释以下行(并更改SSL文件的路径):

ssl=true
ssl-ca=/etc/mysql/ssl/ca-cert.pem
ssl-cert=/etc/mysql/ssl/server-cert.pem
ssl-key=/etc/mysql/ssl/server-key.pem

3) Restart mariadb/mysql: 3)重新启动mariadb / mysql:

sudo systemctl restart mariadb

4) Loggin to mariadb using ssl: 4)使用ssl登录到mariadb:

sudo mysql --ssl -u root -p

It will ask for the root password of mariadb/mysql. 它将要求输入mariadb / mysql的根密码。

5) And finally remove the "REQUIRE SSL" constraint for the root user: 5)最后,为根用户删除“ REQUIRE SSL”约束:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' REQUIRE NONE;
FLUSH PRIVILEGES;
QUIT;

After which your can log as root with phpmyadmin as you could before. 之后,您可以像以前一样以phpmyadmin根用户身份登录。

I hope this helps anyone in your situation as I fell in the same trap myself. 我希望这能对您遇到的任何情况有所帮助,就像我自己陷入同样的​​陷阱一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM