Workaround (ERROR 1698 (28000): Access denied for user ' root ' @ ' localhost ') cannot be logged after MySQL installationSteps to resolve:
[====>>https://www.cnblogs.com/leolztang/p/5094930.html1. sudo mysql-u root-P2.SelectUser, Plugin fromMysql.user;3. Update Mysql.userSetAuthentication_string=password ('newpwd'), plugin='Mysql_native_password' whereUser='Root';4. Flush privileges;5. exit
6. Restart the entry
1. Delete MySQL
A. sudo apt-get autoremove--purge mysql-server-5.0B. sudo apt-get Remove mysql- serverc. sudo apt-get autoremove mysql-serverd. sudo apt-get Remove Mysql-common ( Very important)
In fact, some of the above is redundant, it is recommended to follow the order
2. Clean up residual data
' {print $} ' |sudo xargs dpkg-p
3. Install MySQL
A. sudo apt-get install mysql-serverb. sudo apt-get install mysql-clientc. sudo apt- Get Install php5-mysql (install Php5-mysql to connect PHP with MySQL)
Once the installation is complete, the MySQL server should start automatically. You can check whether the MySQL server is running by running the following command at the terminal prompt:
4. Check if MySQL is running
sudo netstat-tap | grep MySQL
When you run the command, you can see a line similar to the following:
[email protected]:~# sudo netstat-tap | 00 localhost.localdo:mysql *:*870/mysqld
If the server does not function correctly, you can start it by using the following command:
Sudo/etc/init.d/mysql restart
Open MySQL:
sudo mysql
This article is mainly excerpted from: 78901889