Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   PHP and MySQL (http://www.go4expert.com/forums/php-and-mysql-t29048/)

AimyThomas 6Sep2012 09:24

PHP and MySQL
 
Hello,

While I was interpretation the PHP manual on database security the recent past, it said that you should by no means connect to the database as the super user but rather as one more user with more limited options.
My question is:
How do you generate new users and set access levels for them in MySQL?

Secondly, if a website does not offer PHP Admin, how can I use a database I created in phpMyAdmin on my PC for that website?

Thank in Advance

anthonyemuobo 31Mar2015 22:45

Re: PHP and MySQL
 
Generating User is easy with MySQL as it is easy in phpmyadmin. The format for creating users is:

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

and after creating the user we use to the below syntax to grant privileges.

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

Hope this helps.


All times are GMT +5.5. The time now is 21:02.