Mysql Access denied for user 'root'@'localhost'

If none of the more specific forums is the right place to ask

Mysql Access denied for user 'root'@'localhost'

Postby philo_neo » 2017-12-27 12:49

Hello,
I went to configure my MySQL server on Debian 8.8.
when I make a
Code: Select all
 mysql -u root -p,
it returns to me a password request that
Code: Select all
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I lost, how to reset the password of root on localhost?
User avatar
philo_neo
 
Posts: 77
Joined: 2010-06-18 16:48

Re: Mysql Access denied for user 'root'@'localhost'

Postby dcihon » 2017-12-27 13:24

Google search came up with this:
https://stackoverflow.com/questions/41645309/mysql-error-access-denied-for-user-rootlocalhost

You probably need to do some reading on mysql.
dcihon
 
Posts: 226
Joined: 2012-09-23 16:18

Re: Mysql Access denied for user 'root'@'localhost'

Postby philo_neo » 2017-12-27 13:33

when i put this command
Code: Select all
 /etc/my.cnf
Add skip-grant-tables under [mysqld]


i have this error
Code: Select all
mysql -u root -p
mysql: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
mysql: [ERROR] Fatal error in defaults handling. Program aborted!
root@dct-tousin:/var/lib/mysql# /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.


when i delete
Code: Select all
/etc/my.cnf
Add skip-grant-tables


the server start normaly !

PS I have already done some research on google
User avatar
philo_neo
 
Posts: 77
Joined: 2010-06-18 16:48

Re: Mysql Access denied for user 'root'@'localhost'

Postby dcihon » 2017-12-27 13:51

I am not an expert at this but post the contents of my.cnf first to see if someone here with mysql can spot something that might be out of place.
dcihon
 
Posts: 226
Joined: 2012-09-23 16:18

Re: Mysql Access denied for user 'root'@'localhost'

Postby steve_v » 2017-12-27 14:26

philo_neo wrote:when i delete
Code: Select all
/etc/my.cnf
Add skip-grant-tables


the server start normaly !

No shit, your config syntax is FUBAR.
Don't just paste the whole lot into the file, that was an instruction to add the key 'skip-grant-tables' to the appropriate section in my.cnf. The error indicates that it is not.
Go read the manual.
steve_v
 
Posts: 695
Joined: 2012-10-06 05:31
Location: New Zealand


Return to General Questions

Who is online

Users browsing this forum: Morales1235 and 2 guests

fashionable