Install MySQL
Sudo apt-get install mysql-server
This should be very simple, and I don't think there is much problem with the installation, so I will not talk about it much. Next we will talk about the configuration in Ubuntu.
Configure MySQL
Note: In Ubuntu, MySQL only allows local access by default. If you want access from other machines, you need to change the/etc/mysql/my. cnf configuration file! Next we will step by step:
After the default MySQL installation, the root user does not have a password. Therefore, use the root user to enter:
$ Mysql-u root
-U root is used here because I am a general user (firehare). If-u root is not added, mysql will assume that it is a firehare logon. Note: I have not entered the root user mode here because it is unnecessary. In general, it is not necessary to enter the root user mode to operate the database in mysql. This is only possible when the database is set.
After entering mysql, the most important thing is to set the root user password in Mysql. Otherwise, the Mysql service is no longer secure.
Mysql> grant all privileges on *. * TO root @ localhost identified by "123456 ";
Note: I use 123456 as the root user password, but this password is not safe. Please use a password with a mix of uppercase and lowercase letters and numbers, and at least 8 characters.