Create a Database and Assign a User

This is a very simple snippet about how to create a database 1st, a user and then assign some privileges to the user to allow him/her to perform some specific actions like insert, create, update, select etc.

[View All Snippets]
Show Plain Text »
  1. -- Create database, user and grant all privileges
  2. CREATE DATABASE database_name;
  3. CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';
  4. GRANT ALL PRIVILEGES ON database_name.* TO 'user_name'@'localhost';
  6. -- To grant just specific privileges, use the following format:
Create Your Free Account
Please remember that this information is essential to use our services correctly.
After creating the account you will be able to download all of our FREE products.
Fields marked with * are mandatory

Please send me information about updates, new products, specials and discounts from ApPHP!
We recommend that your password should be at least 6 characters long and should be different from your username/email. Please use only letters of the English alphabet to enter your name.

Your e-mail address must be valid. We use e-mail for communication purposes (order notifications, etc). Therefore, it is essential to provide a valid e-mail address to be able to use our services correctly.

All your private data is confidential. We will never sell, exchange or market it in any way. Please refer to Privacy Policy.

By clicking "Create Account", you are indicating that you have read and agree to the ApPHP Terms & Conditions.