1. follow the prompts to install mysql2 and run cmd to enter the mysql installation directory. my installation directory is C: ProgramFilesMySQLMySQLServer56bin. enter cdC: ProgramFilesMySQLMySQLServer56bin3 using my
1. follow the prompts to install mysql2. run cmd to enter the mysql installation directory. enter cd C in my installation directory C: \ Program Files \ MySQL Server 5.6 \ bin: \ Program Files \ MySQL Server 5.6 \ bin3. use mysqld to register mysql as a service. run the following command: mysqld-install MySQL4. start the service: net start MySQL5. then log in, because the default password of the root user is blank, press enter to enter mysql-u root-p6. ① show databases; ② use mysql; ③ set password for 'root' @ 'localhost' = PASSWORD ('000000'); ④ quit;
# Add a user account that can be remotely logged on and set a password of 123456 to allow access to all databases. for example, if remote access fails, disable the firewall or add inbound and outbound rules, add port 3306 GRANT all privileges on *. * TO 'user' @ '%' identified by '000000' with grant option; flush privileges; # mysql adds user1 and authorizes access TO the specified database db123, and set the password 333333 grant all privileges on db123. * to 'user1' @ '%' identified by '000000' with grant option; flush privileges; # mysql adds user2, grants access to the specified database db123, sets the password 666666, and restricts logon to the specified IP address segment grant all privileges on db123. * to 'user2' @ '123. 168.104.% 'identified by '000000' with grant option; flush privileges;
MySQL creates, authorizes, deletes, and password 1. creates a user. // Log on to MYSQL @> mysql-u root-p @> password // Create a user mysql> insert into mysql. user (Host, User, Password) values ("localhost", "phplamp", password ("1234"); // refresh the system permission table mysql> flush privileges; in this way, a user named: phplamp password: 1234 is created. Then log on. Mysql> exit; @> mysql-u phplamp-p @> enter the password mysql> login successful 2. authorize the user. // Log on to MYSQL (with ROOT permission ). I log on as ROOT. @> mysql-u root-p @> password // first create a database for the user (phplampDB) mysql> create database phplampDB; // authorize the phplamp user to have all permissions on the phplamp Database.> Grant all privileges on phplampDB. * to phplamp @ localhost identified by '000000'; // refresh the system permission table mysql> flush privileges; mysql> Other Operations/* if you want to specify some permissions for a user, you can write it like this: mysql> grant select, update on phplampDB. * to phplamp @ localhost identified by '000000'; // refresh the system permission table. Mysql> flush privileges; */3. delete a user. @> Mysql-u root-p @> password mysql> delete from user WHERE User = "phplamp" and Host = "localhost"; mysql> flush privileges; // delete the user's database mysql> drop database phplampDB; 4. modify the password of a specified user. @> Mysql-u root-p @> password mysql> update mysql. user set password = password ('New password') where User = "phplamp" and Host = "localhost"; mysql> flush privileges;