I'm trying to log into MySQL on a remote server. I have ssh-ed into the server, and I am trying to access the server's local MySQL db.
I got the login credentials from the config file of a local application
mysql -u user -p
but when I login using the same password, I get
ERROR 1045 (28000): Access denied for user 'user'@'localhost'
Details:
username: user
password: password
table : table_name
host : localhost
I have tried the same password a few times, but there must be something other than an incorrect password. I'm very confused, what am I doing wrong?
get root privileges.
sudo bash
stop mysql server -- ubuntu example
service mysql stop
open mysql without checking passwords -- ubuntu example
/usr/bin/mysqld_safe --skip-grant-tables &
log in as root
mysql --user=root mysql
Enable privileges
flush privileges;
Change the password and grant any access you might need
update user set Password=PASSWORD('password') WHERE User='username';
GRANT ALL ON table_name.* TO 'username'@'localhost' ;
flush privileges;
exit ;
Exit safe mode and restart
kill cat /var/run/mysqld/mysqld.pid
service mysql start
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.