MARIADB MYSQL Creating Database and Giving Permission

Very small but very use-full about creating database and giving permission to your database so you can connect your PHP or whatever application to MARIADB and or MYSQL – To me they all the SAME lol

I am assuming you’ve installed mysql , From your shell prompt

mysql -uroot -p

If your database server is host some place else then

mysql -uroot -pYOURPASSWORD -hSERVERNAME

Let’s create Database

create database TEST;
CREATE USER 'YOURUSERNAME'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
GRANT ALL ON *.* TO 'YOURUSERNAME'@'localhost';
FLUSH PRIVILEGES;

Please note If your database server is elsewhere, then instead of using localhost, You just need to use your database server name just so you give write permission.

Leave a Reply

Your email address will not be published. Required fields are marked *