So we decide to remove the mysql server and reinstall again, below are the step that we were done.
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysql
sudo apt-get dist-upgrade
Ensure there are no .my.cnf file
sudo find / -name my.cnf
find all my.cnf file for mysql and rm -rf themnetstat -tulnp | grep <port no>
if it is find task uses 3306 and remove it
lsof -i :3306
kill task_idhttps://www.binarytides.com/close-open-ports-manually-in-ubuntu/
Check mysql error log
/var/log/mysql/error.log
reinstall and set root password, and set login without sudo
login mysql sudo mysql -u root -p (default password is empty)
UPDATE
mysql.user
SET
Password = PASSWORD('YOURNEWPASSWORD')
WHERE
User = 'root';
FLUSH PRIVILEGES;
exit;
https://stackoverflow.com/questions/16556497/how-to-reset-or-change-the-mysql-root-password
Some systems like Ubuntu, mysql is using by default the UNIX auth_socket plugin.
Basically means that: db_users using it, will be "auth" by the system user credentias. You can see if your
root
user is set up like this by doing the following:$ sudo mysql -u root # I had to use "sudo" since is new installation
mysql> USE mysql;
mysql> SELECT User, Host, plugin FROM mysql.user;
+------------------+-----------------------+
| User | plugin |
+------------------+-----------------------+
| root | auth_socket |
| mysql.sys | mysql_native_password |
| debian-sys-maint | mysql_native_password |
+------------------+-----------------------+
As you can see in the query, the
root
user is using the auth_socket
plugin
There are 2 ways to solve this:
- You can set the root user to use the
mysql_native_password
plugin - You can create a new
db_user
with yousystem_user
(recommended)
Option 1:
$ sudo mysql -u root # I had to use "sudo" since is new installation
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ service mysql restart
https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost
No comments:
Post a Comment