Windows will need to do some security after the default installation MySQL. First like this: mysql> use mysql; Database Changed Mysql> SELECT HOST, User, Password, SELECT_PRIV, GRANT_PRIV from User; ------ ---- --------- - ------------- ---------- | Host | User | Password | SELECT_PRIV | GRANT_PRIV | ------ - ------ ---------- ------------ ------------ | localhost | root | | Y | Y | | Buider | ROOT | | Y | | | Y | Y | | | | | N | N | ------- - ----- - ------ ------------- ---------- 4 ROWS in set (0.00 sec)
By default, you can log in to Mysql without any user; the root user from localhost is no password. Once someone disguised into root users from the Buider, security will be challenged.
Then you need to delete an extra user: mysql> delete from user where user = ''; mysql> delete from user where host = 'buider';
The default root user is also modified: mysql> Update user set password = password ('123456') where user = 'root'; mysql> flush privileges;
Thus, the password of the MySQL database root user is changed to 123456. One of the last commands of the command flush privileges means to enforce the memory authorization form, otherwise or buffer passwords, the illegal users can also log in with the root user and empty ports until the MySQL server is restarted.
Let's take a look: mysql> Select Host, User, Password, SELECT_PRIV, GRANT_PRIV from User; ------------------ ---------- ---------- ------------- ------------ | Host | User | Password | SELECT_PRIV | GRANT_PRIV | ----------- --------------------------- ------- ---- ------------ | localhost | root | 565491d704013245 | Y | Y | ---------- -------- - ------------------ ------------ 1 ROWS In set (0.03 sec) is unwise to use the root user, because it has too much permission, there should be security issues when actual use, and you should build a user, let him as long as SELECT, INSERT, UPDATE, DELETE Basic permissions can be. To create a user password called JavaPro to 123456, it can only come from localhost and manipulate all tables below: MySQL> Grant SELECT, INSERT, UPDATE, DELETE ON Process. * To javapro @ localhost iDentified by "123456"; query OK, 0 ROWS Affected (0.00 SEC)
Let's check it back: mysql> select host, user, password, select_priv, grant_priv from user; ------------------ --------------- ------ ------------ ------------- ------------ | Host | User | Password | SELECT_PRIV | GRANT_PRIV | ----------- ----------------------- ------ ------------ | localhost | root | 565491d704013245 | Y | Y | | Localhost | JavaPro | 565491D704013245 | Y | N | ------ ---- --------- ---------------- ------------- - ---------- 2 ROWS IN SET (0.00 sec)
Ok, in the program, we only need to use JavaPro users to make basic operations for our worksheet Process.