I started to install MySQL today. I used to download the installation package from the official website, but it was not available after installation. I guess it was necessary to configure it. I found a lot of information on the Internet and the result still failed. Therefore, you have to install it in the software source, which saves a lot of unnecessary trouble.
zhiniaobu@telunsu-K55VD:~$ sudo apt-get install mysql-server[sudo] password for zhiniaobu:
After executing this command, the system will automatically install other software. During the installation process, the system will prompt you to enter the mysql login password.
If the system version is different, the prompt method may be different, but it is similar in general. After installation, execute the command
zhiniaobu@telunsu-K55VD:~$ mysqlERROR 1045 (28000): Access denied for user 'zhiniaobu'@'localhost' (using password: NO)zhiniaobu@telunsu-K55VD:~$
The result was wrong. After Google for half a day, the result became less and less patient. At this time, I flipped through my own books and entered the following command.
zhiniaobu@telunsu-K55VD:~$ mysql -uroot -pmysql
Where
First mysqlYes command,
-UrootIs to specify the user as root,
-PmysqlEnter the login password, and the second mysql is the password. If you set another password, replace it with the password you set during installation. Remember
Password and-pBetween
Do not have spacesOtherwise, it will fail. The following shows how to view all existing databases after I log on successfully.
zhiniaobu@telunsu-K55VD:~$ mysql -uroot -pmysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 61Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema |+--------------------+3 rows in set (0.00 sec)mysql>