I’ve ssh onto server. Then tried to use mysqladmin -u root -p ‘password’ to access mysql, but that doesn’t work. How can I add a user to mysql? which command should I use?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
@themadman300 <br>I didn’t install mysql myself. I use the Lamp image when I create the Droplet. <br>After I login to server, actually I can’t do anything on Mysql. <br> <br>Especially, I was told this every time I logged in: <br>------------------- <br>Please be sure to change your root MySQL password; current MySQL password is “password” <br> <br>You can change the MySQL password with the following command: <br> <br>mysqladmin -u root -p’password’ password newpassword <br>------------------- <br> <br>But I still can not access Mysql using the command it gives me: mysqladmin -u root -p’password’ password newpassword <br> <br>Do you have any idea?
Did you restart MySQL and set a password yet? Restart the mysql service and set a pass for MYSQL root, use that pass for mysql. <br>
@themadman300 <br>I tried it, but here is what I get: <br>ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Use <br>mysql -u root -p <br>Enter your password <br> <br>CREATE USER ‘username’@‘host’ IDENTIFIED BY ‘password’;