Create MySQL database and user (including MYSQLdump)


IT IS NOT FINISHED YET

There are loads of ways to do this, Webmin, PHPmyadmin, MySQL GUI tools but if all you have is a Linux command line then you need the good old fashioned native MySQL commands

You will need mysql installed for this to work

yum install mysql
mysql -u (root user of database) -p -h (server name of MySQL database)
eg. mysql -u mysqlroot -p -h localhost

Once you have a command line then you need to create the user, you can also create the database whilst you are here

Create the database

create database (database name);

Now create the user

create user 'username'@'localhost' identified by 'password';
create user 'username'@'%' identified by 'password';
grant all on databasename.* to 'username'@'localhost' with grant option;
grant all on databasename.* to 'username'@'%' with grant option;

To create a mysql dump there are a few options, output to a sql file that then can be user to create the database or straight to the remote data base. Cloning to a remote database can be found in the Duplicate Sugar CRM instance

To create a sql file then

mysqldump -u (root name of mysql) --password=the password 
-h (host name of the server) datbase_name > sqlfilename.sql

You can then link to the database that you wish to run the sql file into by using the following command.

mysql -u (root name of mysql) -p -h (host name of the server) < sqlfilename.sql
Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s