Trying to set MySQL root password results in error
I'm still very new to MySQL and Debian, but have been reading a lot during the last days.
I have a root account to a virtual machine that I want to use for Wordpress. One thing I read was that I should password protect MySQL because by default root user doesn't need a password for it.
I read someone doing it like this:
mysql> mysqladmin -u root password mypassword;
But that gives me the following error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqladmin -u root password mypassword' at line 1
Solutions
You are running the command from within mysql, but the command is actually meant to be run directly from the terminal.
mysqladmin -u root password mypassword
If you are already in
mysql
within terminal, type
exit
then enter your
mysqladmin
command.