mysql installation and common commands

Download mysql-5.7.9-winx64.zip from the official website


 Note: Remember the password automatically generated by MySQL above

mysql -u root -p password

 

Create user and authorize

--create user and authorize
命令:CREATE USER 'username'@'host' IDENTIFIED BY 'password';
example:
CREATE USER 'dog'@'localhost' IDENTIFIED BY '123456';
CREATE USER 'pig'@'192.168.1.101' IDENDIFIED BY '123456';
CREATE USER 'pig'@'%' IDENTIFIED BY '123456';
CREATE USER 'pig'@'%' IDENTIFIED BY '';
CREATE USER 'pig'@'%';
Authorize root IP access
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '' WITH GRANT OPTION;
flush privileges;
--Set and change user password
Set another user password: SET PASSWORD FOR 'username'@'host' = PASSWORD('newpassword');
Set the current user password: SET PASSWORD = PASSWORD("newpassword");
--delete users
Delete command: DROP USER 'username'@'host';

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326569669&siteId=291194637