Ubuntu install MySQL password initialization problem

After installing MySQL with sudo apt-get install mysql-server mysql-common command on Ubuntu, there is no prompt for password during installation. Then use mysql -u root -p to log in, and then ask for a password, but no matter how you enter it, it prompts that the password is wrong. How to solve it?

The plan is as follows:

  1. Open the /etc/mysql/debian.cnf file, in this file there are the user name and password that the system assigns to us by default, and you can directly operate MySQL through this password.
  2. Log in with debian-sys-maint as the user name and the password is the one in debian.cnf. Use mysql -u debian-sys-maint -p to log in.
  3. After entering mysql, modify the MySQL password. The specific operation is as follows: set password for'root'@'localhost' = password('yourpass');After the modification, MySQL should be operated normally.

Recommended Posts

Ubuntu install MySQL password initialization problem
Install mysql under Ubuntu 16.04
Install mysql on Ubuntu 14.04
Ubuntu19 install MySQL pit
Install MySQL under Ubuntu
How to install MySQL on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
Install and configure MySQL on Ubuntu
How to install mysql in Ubuntu 14.04
How to install mysql in Ubuntu 14.04
How to install MySQL on Ubuntu 14.04
Detailed steps to install MySQL to change the default password in Ubuntu
Centos7 compile and install MySQL8 problem record
How to change MySQL password under Ubuntu
CentOS7.2 install Mysql5.7.13
CentOS7 install MySQL
ubuntu18.04 install python2
ubuntu12.04 install python3
Ubuntu install guide
ubuntu install nodejs
ubuntu 16 install asp.net
ubuntu install leanote
ubuntu install Jenkins
CentOS7 install mysql
CentOS 7 install MySQL 5.6
docker install ubuntu
ubuntu install elasticsearch
CentOS8 install MySQL8.0
CentOS7 install mysql8
Ubuntu14 upgrade MySQL
CentOS7 install MySQL8
ubuntu16.0.1 install pagoda
ubuntu18.04 install python
centos 7.5 install mysql5.7.17
ubuntu 18.04 install teamviewer
ubuntu install sendmail
How to install the latest MySQL on Ubuntu 18.04
install vscode on ubuntu18
Install node.js under Ubuntu
Install mysql-pytho in Ubuntu
ubuntu install zsh terminal
Install Redis on Ubuntu
Install R4 on ubuntu20
Install nvtop on Ubuntu 18.04
Install postgresql-10 on Ubuntu 18.04
Install docker on Ubuntu
CentOS6.5 offline install MySQL5.6.26
Install MySQL5.7 in centos7
Install mysql5.7 under CentOS7
Ubuntu18.04 install opencv 3.2.0 solution
Install Thrift under ubuntu 14.10
Install OpenJDK10 under Ubuntu
Install Caffe under Ubuntu 14.04
Install Docker on ubuntu18.04
Install nodejs10 on Ubuntu16
How to install and use MySQL Workbench on Ubuntu 18.04
ubuntu install harbor warehouse
Ubuntu16.04 install Mongodb tutorial
Install Django on ubuntu
CentOS 7.2 Yum install MySQL 5.6
Install Pytorch+CUDA on Ubuntu 16.04