Ubuntu 18.04.1 mysql password settings, and can be set without sudo login
Description: After installing Ubuntu 18.04.1 , you cannot execute the mysql command as a user. You must use sudo to execute the mysql directive, and any php program may not be able to connect to mysql. Step1: Login to the mysql interface example: Sudo mysql -uroot -p Enter password: [press Enter directly] Step2: Modify the account management mode and change password mysql> Use mysql; mysql> Update user SET plugin='mysql_native_password' WHERE User='root'; mysql> Update user set authentication_string=password('root new password') where user='root'; mysql> Flush privileges; Step3: After logging out, you can use the following mysql command without adding sudo