Creating a user at MySQL Server Level for website -
i have developed mysql based php website using database , managing users account in users
table. had difficulty in managing privileges each user int users table.
i have found there server lever privileges readily available use. these:-
grant privileges on *.* 'john'@'localhost' require none grant option max_queries_per_hour 0 max_connections_per_hour 0 max_updates_per_hour 0 max_user_connections 0;
or
create user 'john'@'localhost' identified mysql_native_password '***';grant select, create, drop, reload, shutdown, process, references, index, alter, show databases, super, create temporary tables, lock tables, replication slave, replication client, create view, event, trigger, show view, create routine, alter routine, create user, execute on *.* 'john'@'localhost' require none grant option max_queries_per_hour 0 max_connections_per_hour 0 max_updates_per_hour 0 max_user_connections 0;
the first sql granting privileges , second 1 creating new user , setting privileges.
my query: programming practices create user @ server level?
if you're creating website , need grant privileges users, create privilege system , grant user own privilege level. may store these privileges in separate table in database. but, different thing granting privileges database. queries ask create users of database , grant them privileges manage whole database , data in it. shouldn't if not sure you're doing.
Comments
Post a Comment