Ubuntu View and modify the login name and password of mysql and install phpmyadmin

  • 2021-12-13 17:32:23
  • OfStack

After installing mysql, enter mysql-u root-p at the terminal, press Enter, and prompt access denied...... ues password YES/NO error after entering password

The reason is that the user name or password is wrong!

View and modify the user name and password of mysql

Step 1:

At this time, you need to enter the/etc/mysql directory, and then sudo vim/vi debian. cnf looks at the username and password inside, and then uses the username and password in this file to enter mysql. If the username in debian. cnf is debian-sys-maint, then:

mysql -u debian-sys-maint -p Press Enter, which requires you to enter your password. Copy the password in debian. cnf (do not enter it manually, because it is prone to errors).

At this time, you can enter mysql

Step 2:

Modifier root password

Log in to the mysql client according to the previous step


mysql> use mysql;
Database changed
mysql> update user set password=password('new password') where user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit

Step 3:

Log in with the new root and password.

Installing phpmyadmin

1. Open the terminal and enter sudo apt-get install phpmyadmin , Enter

2. Then, after the installation is completed, check under the apache server directory (which has been changed from/var/www/html to/media/home/ivalley) and find that there is no such file or folder as phpmyadmin

3. This is the key point. When the system installs the software, the software is installed under/usr/share/by default, so your phpmyadmin can be found under/usr/share

4. Therefore, we must establish a soft link to link the file shown in Step 3 to a document under/media/home/ivalley, and enter the following code sudo ln -s /usr/share/phpmyadmin /media/home/ivalley/phpmyadmin

5. Next, open the browser, enter http://localhost/phpmyadmin, enter your account name and password, and you can log in smoothly and use the MySQL database happily

Summarize

Above is this site to introduce you to Ubuntu view modify mysql login name and password, install phpmyadmin, I hope to help you, if you have any questions welcome to leave me a message, this site will reply to you in time!


Related articles: