-2

When enter to terminal: MySQL -u root -p I get answer: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)bash: Cd: /path/to/directory : No such file or directory

When i enter to terminal "superuser do -s" I get this answer:No such file or directory. All answer I see here need use MySQL to get permissions, so there it was not possible for me. I do have root access to my server so it should be possible to fix this. And I had this before. Happy to get help with this.

  • 1
    Resetting the root password [is well documented](https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html). – Gerald Schneider Mar 20 '20 at 12:52
  • The commands for accessing the OS-level superuser (on Unixoid systems) are spelled `su` and `sudo`, but MySQL userids like 'root' are separate from and mostly unrelated to OS-level userids. – dave_thompson_085 Mar 20 '20 at 14:42

1 Answers1

1

MySQL -u root -p

I get answer: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

The mysql command-line utility is called mysql - all lower case. Since you got back a "sensible" (if undesirable) response from mysql, I can only assume your spelling checking intercepted this during posting.

The wrong password was given for the root account.

Either you entered it incorrectly (which you, quite rightly, did not show us) or mysql tried to read the value from a configuration file (my.cnf is most common, if I recall correctly) but that value was also incorrect.

The root account in MySQL is nothing to do with the root account on your server. THey will not have the same password. You may need to reset the MySQL root password.

bash: Cd: /path/to/directory : No such file or directory

The command to change directories is cd (spell-checker again?)

That is an example of a path to a directory (a.k.a. Windows "Folder"). You need to replace it with the path that is relevant on your server.

"superuser do -s"

The command to execute commands under another account is sudo.

It expects whatever you supply after the "-s" argument to be a command that it can run - you did not supply one, so it tried to execute an "empty" value (hence the error message apparently starting with a colon; the failing command normally appears before the colon).

I do have root access to my server ...

Having root access to the server is not the same as having root access to the database.

I would strongly recommend getting a few unix basics under your belt before proceeding much further. Compared to other operating systems, Unix commands can be terse and obscure but are sufficiently powerful to do a great deal of damage to your server, particularly when used by the root account.

Phill W.
  • 1,479
  • 7
  • 7