root@localhost:~# mysql -u root -pa1b2c3
Welcome tothe MySQL monitor. Commands endwith ; or \g.
Your MySQL connection idis45
Server version: 5.5.54-0ubuntu0.14.04.1-log (Ubuntu)
Copyright (c) 2000, 2016, Oracle and/orits affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/orits
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
设置密码
SET PASSWORD FOR'root'@'localhost' = PASSWORD('newpass');