Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of insufficient mysql permissions for linux php connection

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to solve the problem of insufficient permissions for linux php connection mysql". In daily operation, I believe that many people have doubts about how to solve the problem of insufficient access to linux php connection mysql. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for everyone to answer the question of "how to solve the problem of insufficient permissions for linux php connection mysql". Next, please follow the editor to study!

Linux php connection mysql insufficient solutions: 1, through the use of grant commands to ordinary data users to grant query, insert and other permissions; 2, through grant to database developers to create tables and indexes and other permissions.

This article operating environment: linux5.9.8 system, PHP7.1 version, DELL G3 computer

What if there are not enough mysql permissions for linux php connections?

Insufficient mysql permissions for linux php connection, fine permission division for mysql:

In mysql, a user can be granted one or more of these permissions, such as select,insert,update,delete, mainly using the grant command in the following format:

Grant permissions on database object to user

Grant ordinary data users have the right to query, insert, update and delete all table data in the database

Grant select on testdb.* to common_user@'%'grant insert on testdb.* to common_user@'%'grant update on testdb.* to common_user@'%'grant delete on testdb.* to common_user@'%'

Or, replace it with a mysql command:

Grant select, insert, update, delete on testdb.* to common_user@'%'

Second, grant database developers, create tables, indexes, views, stored procedures, functions. Equal authority

Grant creates, modifies, and deletes mysql data table structure permissions. Grant create on testdb.* to developer@'192.168.0.%';grant alter on testdb.* to developer@'192.168.0.%';grant drop on testdb.* to developer@'192.168.0.%';grant manipulates mysql foreign key permissions. Grant references on testdb.* to developer@'192.168.0.%';grant manipulates mysql temporary table permissions. Grant create temporary tables on testdb.* to developer@'192.168.0.%';grant manipulates mysql index permissions. Grant index on testdb.* to developer@'192.168.0.%';grant manipulates mysql view and view view source code permissions. Grant create view on testdb.* to developer@'192.168.0.%';grant show view on testdb.* to developer@'192.168.0.%';grant manipulates mysql stored procedures and function permissions. Grant create routine on testdb.* to developer@'192.168.0.%';-now, can show procedure statusgrant alter routine on testdb.* to developer@'192.168.0.%';-now, you can drop a proceduregrant execute on testdb.* to developer@'192.168.0.%'

3. The right of grant ordinary dba to manage a certain mysql database

Grant all privileges on testdb to dba@'localhost'

The keyword "privileges" can be omitted.

4. Grant Advanced dba manages the permissions of all databases in mysql

Grant all on *. * to dba@'localhost'

5. Mysql grant permissions, which can be used at multiple levels.

1. Grant acts on the entire mysql server:

Grant select on *. * to dba@localhost;-dba can query tables in all databases in mysql. Grant all on *. * to dba@localhost;-dba can manage all databases in mysql

2. Grant acts on a single database:

Grant select on testdb.* to dba@localhost;-dba can query tables in testdb.

3. Grant acts on a single data table:

Grant select, insert, update, delete on testdb.orders to dba@localhost

4. Grant acts on the columns in the table:

Grant select (id, se, rank) on testdb.apache_log to dba@localhost

5. Grant acts on stored procedures and functions:

Grant execute on procedure testdb.pr_add to 'dba'@'localhost'grant execute on function testdb.fn_add to' dba'@'localhost'

6. View mysql user permissions

View current user (own) permissions:

Show grants

View additional mysql user rights:

Show grants for dba@localhost

7. Revoke the permissions that have been granted to mysql users

The syntax of revoke is similar to that of grant, except that you can replace the keyword "to" with "from":

Grant all on *. * to dba@localhost;revoke all on *. * from dba@localhost

VIII. Considerations for user rights of mysql grant and revoke

1. After the grant, revoke user permission, the user will not take effect until the user reconnects to the mysql database.

two。 If you want authorized users, you can also grant these permissions to other users. You need the option "grant option".

Grant select on testdb.* to dba@localhost with grant option

This feature is generally not needed. In practice, database permissions are best managed by dba.

Note: be sure to refresh the service or restart the service after modifying the permissions

At this point, the study on "how to solve the problem of insufficient permissions for linux php connection mysql" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report