Creating a new user and database in mysql
Posted: Thu Jan 01, 2009 3:57 am
To create a new user and database run these to commands in a terminal (when it prompts for a password it is hda)
We will assume here the username and database to be created are these (change for your case appropriately):
The first step is creating the db:
Then create a user for it (also type hda as the password when prompted:
Go to option 5
Then choose database by typing gallery and press Enter.
When asked for the username,
type: gallery again. This will be the user name.
Yah!
Stick to hda if you trust your network, otherwise chose a password.
Then comes choosing the hosts allowed:
Type localhost. When asked for more hosts, say no. Stick to that unless you know you are going to be accessing the DB from other hosts in the network.
Type yes to the "are you sure?" question.
This will creates the following
DB Name: gallery
User name: gallery
Password: whatever you type
We will assume here the username and database to be created are these (change for your case appropriately):
Code: Select all
Database: gallery
User name: gallery
Code: Select all
mysqladmin -uroot -p create gallery
Code: Select all
mysql_setpermission --u root
Code: Select all
5. Create/append quite extended user privileges for an
existing database and host combination (user can do
SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,
LOCK TABLES,CREATE TEMPORARY TABLES)
Code: Select all
Which database from existing databases would you like to select:
You can choose from:
- amahi_development
- gallery
Which database will it be (case sensitive). Type * for any:
When asked for the username,
Code: Select all
What username is to be created:
Code: Select all
Would you like to set a password for gallery [y/n]:
Stick to hda if you trust your network, otherwise chose a password.
Then comes choosing the hosts allowed:
Code: Select all
We now need to know from what host(s) the user will connect.
Keep in mind that % means 'from any host' ...
The host please:
Type yes to the "are you sure?" question.
This will creates the following
DB Name: gallery
User name: gallery
Password: whatever you type