With the popularization of the network, more and more network-based applications are available for MySQL database in terms of network security. Network databases are one of them. One or several servers can provide services to many customers. this method brings a lot of convenience to people, but it also gives criminals a chance to take advantage of it. Because the data is transmitted over the network, it can be intercepted during transmission or accessed through a very convenient means. For the above reasons, database security is very important. Therefore, this article discusses some functions of the MySQL database in terms of network security.
Account Security
Account is the simplest security measure for MySQL. Each account consists of the user name, password, and location (generally composed of the server name, IP address, or wildcard. If john logs on from server1, the logon permission may be different from that of john logs on from server2.
The user structure of MySQL is user name/password/location. This does not include the database name. The following two commands set SELECT user permissions for database1 and database2.
Grant select on database1. * to 'ABC' @ 'server1' identified by 'password1 ';
Grant select on database2. * to 'ABC' @ 'server1' identified by 'password2 ';
The first command sets User abc to use password1 when connecting to database database1. The second command sets User abc to use password2 when connecting to database database2. Therefore, the passwords of user abc connecting to database database1 and database2 are different.
The above settings are very useful. If you only want users to have limited access to a database but cannot access other databases, you can set different passwords for the same user. If this is not done, it will cause trouble when the user finds that the user name can access other databases.
MySQL uses many authorization tables to track different permissions of users and these users. These tables are MyISAM tables in the mysql database. It is very meaningful to save the security information in MySQL. Therefore, we can use standard SQL to set different permissions.
Generally, three different types of security checks can be used in MySQL databases:
? Logon verification
That is, the most common user name and password verification. Once you enter the correct user name and password, the verification will pass.
? Authorization
After successful login, you need to set specific permissions for this user. For example, whether tables in the database can be deleted.
? Access control
This security type is more specific. It involves the operations that a user can perform on a data table, such as whether the database can be edited or whether data can be queried.
Access control is composed of several privileges related to how to use and operate data in MySQL. They are both Boolean, that is, they are either allowed or not allowed. The following is a list of these privileges:
? SELECT
SELECT is to set whether the user can use SELECT to query data. If you do not have this privilege, you can only execute some simple SELECT commands, such as computing expressions (SELECT 1 + 2) or date conversion (SELECT Unix_TIMESTAMP (NOW.
? INSERT
? UPDATE
? INDEX