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.

Tags: Mysql / Wordpress / Debian

Similar questions

Failed to connect to MySQL: (1045) Access denied for user 'root'@'localhost' (using password: YES)
I am deploying a Wordpress enviroment, and there seems to happen a weird situation. I did some tweakings and set a new root password like this then I changed the settings of bind from /etc/mysql/mysql.conf.d to from 127.0.0.1 to 0.0.0.0 so that I can access it via mySQL Workbench. Which was successful as I now am able to enter the DB from outside s...
Failed to connect to MySQL: Access denied for user 'root'@'localhost' (using password: YES)
I was told by someone else that input this url https://beachbumbookworm.com/service.php into their browser it works. However, when I place the url in my google browser it will not work. I have been working from a tutorial at this site https://codewithchris.com/iphone-app-connect-to-mysql-database/#app at 3.2 in the tutorial. There is a service.php ...
I have installed XAMPP.Now I am trying to install Wordpress and it is asking for a password. I dont understand which password to exactly use here
The above bitnami wordpress module needs a password. I am not aware of which password to give here. Please help.
Can't login to wordpress despite changing password to something known directly in MySQL or using "Password Reset by Email" feature
I'm unable to login to my wordpress site v3.1.3 even though I know the password. To be extra sure, I directly changed the password for the user account (ID=1) with I've verified that: I then go to my wordpress login and am told that my username and password is incorrect. I also tried using the "forgot password" flow that allows me to reset by email...
Reset password - set minimum length for new password
I’m trying to set a minimum length for the new password when resetting the password. I would like to add something like this just functional. Any help with this would appreciated.
Wordpress error: (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) wp-db.php on line 1538
I get this error message when I try to access wp-admin of my wordpress site: I have set up a local server with Wampserver and it worked fine in the beginning, but now this error message appears whenever i try to go to: localhost/wordpress/wp-admin. I have tried to change the password and it didn't help. I have also looked up line 1538 in wp-db.php ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.