Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- delimiter ;
- drop database if exists night_db;
- create database night_db;
- /*
- create a user who will be the owner of the new database. This user will be used
- to create all the tables, views, stored procedures and other schema objects in
- the night_db database.
- grant all permissions to this user to enable them to do anything they want
- inside that database
- */
- grant all on night_db.* to 'night_dbo'@'localhost' identified by 'pass';
- grant select on mysql.* to 'night_dbo'@'localhost'; -- bug fix for toad
- /*
- now i have a web front end written in php but if i use the night_dbo account
- to access the database any haxor who gets his hands on this user and pass could
- gain full control of my database - not good.
- so all i do is i create a new user called night_usr who only has execute permissions
- on stored procs for the night_db database. This means that if a haxor gets hold of
- this account the worst thing they can do is call some stored procs.
- Of course your front end code can also only call stored procs - THIS IS A GOOD THING,
- much better than inline sql as your code will be much cleaner and perform better !!
- */
- grant execute on night_db.* to 'night_usr'@'localhost' identified by 'pass';
- flush privileges;
- select host, user from mysql.user;
Add Comment
Please, Sign In to add comment