Save edit results and exit Vim editor https://jingyan.baidu.com/article/495ba8410ff14d38b30ede01.html
First, we need to use apt to install MySQL with the following command:
sudo apt install mysql-server
When you install MySQL, you need to specify a password for the default "root" user (no need to be too complex Oh ~ O (∩_∩) o)
Description: After installing the Mysql-server, the mysql-client is brought with you, no need to install separately.
After successful installation, the interface looks like this:
Second, the current state of the database can be checked after successful installation. The command is as follows:
sudo service MySQL status
At this point we can see that there is a highlighted active state (running), which indicates that it is currently running.
(Note: The PIP list is installed into Python and the APT installation is installed into Ubuntu.) So using PIP list is not see mysql-server, I do not know people like me for the first time confused? )
In the "Guardian process" noun, Baidu can understand. Here is a blog link for Linux Daemon (daemon)http://blog.csdn.net/bravezhe/article/details/7995625
So far, MySQL has been successfully installed, so let's use the default root user to log in to MySQL with the following command:
Mysql–u root–p
or mysql–uroot–p123456
The latter is seldom used, especially if the password appears this way outside, the reason you understand!
Exit MySQL: exit
Modify the configuration file, support Chinese;
SHOW VARIABLES like '%char% ';
SHOW VARIABLES like '%collo% ';
Collation_connection collation, usually with UTF8_GENERAL_CI
Modify configuration file: [email protected]:/etc/mysql$ sudo nano mysql.cnf(CNF is the short name of config)
After the modification, you need to restart the MySQL service, (no need to stop the service before modification), the command is as follows:
sudo systemctl restart Mysql.service
Modifying the server-side listener address (before modification)
Modify the server-side listener address (modified)
The contents of the modified configuration file are as follows:
To connect to a database:
Step 1: View the IP address of the MySQL server
If you do not create a user, the following prompt will appear when you log in directly with the root user:
So, we need the next steps to create the user (Wendy) and allow other computers to connect to the user.
Step 2: Create Users & Authorizations
Https://dev.mysql.com/doc/refman/5.7/en/create-user.html
----------------------------------------------------------------------------------------------------------
Creating user [Create User]
CREATE USER ' wendy ' @ '% '
Identified by ' 123456 ';
Description: Indicates that all IP addresses can be connected with this user (Wendy).
Flush privilege;
Note: Refresh the permissions to make the above statement effective.
As of now, although the DB can be opened, currently the user does not have any permissions. The next step requires an authorization operation.
authorization [Grant]
Grant all on * * to ' wendy ' @ '% ';
Description: Grant all permissions to ' Wendy ' @ '% ', User (Wendy)
On indicates what table under what database (all table permissions under all databases)
Flush privilege;
Finally, use the Navicat Premium connection
Ubuntu Build Mysql,navicat Premium Connection