Install MySQL8.0 decompressed version tutorial
https://blog.csdn.net/God__is__a__girl/article/details/104141888
MySQL create user
CREATE USER ‘yanru’@‘localhost’ IDENTIFIED BY ‘123456’;
View MySQL port
show global variables like ‘port’;
MySQL view configuration file check order (you can see which configuration file is preferred)
mysql --help | grep ‘Default options’ -A 1
MySQL create user
CREATE USER ‘username’@‘host’ IDENTIFIED BY ‘password’;
Authorize users:
grant all privileges on . to ‘tone’@’%’ with grant option;
Authorize all permissions of the root user and set up remote access
GRANT ALL ON . TO ‘root’@’%’;
GRANT ALL ON means all permissions,% means that all hosts are wildcarded and can access remotely.
ALTER USER'root'@'%' IDENTIFIED WITH mysql_native_password BY'Your own password';
Authorize users and allow users to log in remotely:
Tutorial address:
https://blog.csdn.net/Fmuma/article/details/80386325
GRANT ALL ON . TO ‘root’@’%’;
Possible errors:
ERROR 1410 (42000): You are not allowed to create a user with GRANT
First, you need to execute the following statement to allow the user% to log in
update user set host='%' where user='root';
Modify the password of the database user:
ALTER USER'root'@'%' IDENTIFIED WITH mysql_native_password BY'your database password';
Query the current user table:
select user,host from user;
Results of the:
mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)
Several fields of common concern in the user table:
host: access host
user: access user name
plugin: authentication method (password encryption method)
authentication_string: a long string of characters after the password is encrypted
Remote access to centos development port:
firewall-cmd --zone=public --add-port=3308/tcp --permanent
Note: If it is an Alibaba Cloud server, if you want to add remote port opening, you need to configure the security group in the Alibaba Cloud background to add an open port, or else telnet cannot be connected.
Remote login to access the database
mysql -h 127.0.0.1 -u root -p -P 3306
View the current index of a table
show index from table_name(表名)
Connect to MySQL database remotely, and log in successfully
Among them, the password is 123456, root is the user name, 127.0.0.1 is the address of the database server, and 3306 is the port.
mysql -u root -p123456 -h 127.0.0.1 -P 3306
The structure of the complete command is sufficient to directly follow the password after p:
mysql -u username -p password -h server IP address -P server MySQL port number -D database name