install the MySQL steps on Ubuntu 16.04:
If you are using a previous version of Ubuntu 16.04, you can look here: Ubuntu 14.04/15.10 upgrade to Ubuntu 16.04 LTS.
One. Install MySQL
1. Update the package list before installing:
$ sudo apt update
2. Install MySQL on Ubuntu 16.04:
$ sudo apt-get install mysql-server mysql-client
3. During the installation process, you need to enter the MySQL administrator user (root) password, such as:
Enter the root user password
4. Run the MySQL init security script:
$ sudo mysql_secure_installation
5. Set according to the prompt information:
Set according to the prompt information
Mysql_secure_installation Script settings: Change the root password, remove the anonymous user from MySQL, disable root telnet, delete the test database. Use these options to improve the security of MySQL.
Two. mysql Database basic use
1. Log in with the root user:
$ mysql-u Root-p
2. Enter the root password:
Enter the root password
3. Create a MySQL database and users:
mysql> CREATE DATABASE Snailblog;
The above command creates a database named Snailblog.
4. Create the user and use the Snailblog database:
Mysql> Grant all on snailblog.* to ' Man_user ' identified by ' test1234 ';
Create user
5. Sign in with a new user:
$ mysql-u man_user-p Snailblog
Sign in with a new user
6. Create a table:
mysql> CREATE TABLE User (id INT, name varchar), email varchar (20));
7. Insert Record:
mysql> INSERT INTO User (Id,name,email) VALUES (1, "Bar", "[e-mail protected]");mysql> insert INTO user (Id,name,email VALUES (2, "foo", "[email protected]");mysql> INSERT into user (Id,name,email) VALUES (3, "Cat", "[email protected]");
8. Simple query:
Mysql> SELECT * from user;
Simple query
9. Exit the MySQL command line:
Mysql> Quitbye
10. Stop the MySQL database service:
$ sudo systemctl stop Mysql.service
11. Start the MySQL database service:
$ sudo systemctl start mysql.service
12. Restart the MySQL database service:
$ sudo systemctl restart Mysql.service
13. Check the MySQL running status:
$ sudo systemctl status Mysql.service
Configuration file for 14.MySQL:
$ sudo vim/etc/mysql/mysql.conf.d/mysqld.cnf
MySQL 5.6 Document: http://dev.mysql.com/doc/refman/5.6/en/
Install MySQL to Ubuntu