Report this

What is the reason for this report?

I can not reset the password and MYSQL problem in setting up secure in PHPMyAdmin

Posted on April 29, 2015

Hello dear, I want to reset the password of MYSQL, because even though I know the password generated by the system contained herein** /root/.my.cnf** does not work for nothing, just enter the PHPMyAdmin and more. I’ve tried everything and can not reset. I’ve read the tutorial below, I’ve read the official tutorial mysql also not working. After all, how can I fix this? I try to enter the terminal In terminal type the **mysql command **also not enter, but asks for the password of this error: MySQL ERROR 1045 (28000): Access denied for user ‘root’ @ 'localhost

https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-and-reset-a-root-password-in-mysql

What about creating a layer of security, I did everything to support this tutorial and at the end, when saved and will test displays this error: Webserve 500 internal server error etc etc.

https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-14-04

Who can help I’m immensely grateful. Very Thanks.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This guide should help you to reset your MySQL password by using MySQL’s safe mode to update the user details.

If after you do this you continue to see those 500 errors, please review your Apache log in /var/log/apache2/error.log as additional details of this error should be recorded there and will be helpful in diagnosing the problem.

Ok ryanpq, but still not works… other answer, I am try import by PHPMyAdmin and see the error:

**Erro

Comando SQL: **

Apagar qualquer tabela wp_696xx5w6nk_bwg_album existente

DROP TABLE IF EXISTS wp_696xx5w6nk_bwg_album ;

#1046 - No database selected

Resetting the MySQL root password can be a bit tricky, but it’s definitely doable. It’s important to follow the steps carefully. Since you have tried following tutorials and are still facing issues, I will guide you through the process step by step. Please make sure to follow each step as described.

Resetting MySQL Root Password

Step 1: Stop MySQL Service

First, you need to stop the MySQL service. Open your terminal and type:

sudo systemctl stop mysql

Step 2: Start MySQL with Skip-Grant-Tables

Next, start MySQL with the --skip-grant-tables option. This allows you to access the database without a password:

sudo mysqld_safe --skip-grant-tables &

Step 3: Log in to MySQL

Now, log in to MySQL as the root user. Since you started MySQL with --skip-grant-tables, you won’t be prompted for a password.

mysql -u root

Step 4: Reset Root Password

Once logged in, you can reset the root password. Use the following commands, replacing new_password with your new desired password:

For MySQL 5.7.6 and newer or MariaDB 10.1.20 and newer:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

For MySQL 5.7.5 and older or MariaDB 10.1.20 and older:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');

Step 5: Flush Privileges and Exit

After resetting the password, you need to flush the privileges:

FLUSH PRIVILEGES;

Then exit your Mysql

EXIT;

Step 6: Restart MySQL

Finally, restart the MySQL service:

sudo systemctl start mysql

roubleshooting the 500 Internal Server Error

The “500 Internal Server Error” you encountered when setting up security for PHPMyAdmin might be related to several factors such as incorrect file permissions, issues in the .htaccess file, or PHP configuration issues.

  1. Check Error Logs: Look at the web server’s error logs for specific messages. These logs can often provide detailed information about what’s causing the error.

  2. File Permissions: Ensure that your web files have the correct permissions. Typically, directories should be 755, and files should be 644.

  3. .htaccess Issues: If you have made changes to the .htaccess file, ensure that there are no syntax errors. Even a small typo can cause a 500 error.

  4. PHP Configuration: Check your PHP configuration for any issues. You can also look at the PHP error log for details.

  5. Dependency Issues: Ensure that all required PHP extensions for PHPMyAdmin are installed and enabled.

By carefully following these steps, you should be able to reset your MySQL root password and troubleshoot the 500 internal server error in PHPMyAdmin. Remember to replace new_password with your actual new password, and ensure there are no typos or syntax errors in your commands.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.