How to install/configure MySQL Database
Yum install mysql* mysql-* php* php-*
Post installation:
Admin user id: root
Default password: blank
The first task is to assign a password:
# mysqladmin -u root password 'new-password'
How to download/install phpMyAdmin
2.2.1:
- cd /var/www/html
- Wget http://garr.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.9/phpMyAdmin-4.0.9-all-languages.tar.gz
- Untar the distribution :
tar
xzvf phpMyAdmin-4.0.9-all-languages.tar.gz
mv
phpMyAdmin-4.0.9-all-languages.tar.gz phpMyAdmin
chmod
–R 775 phpMyadmin
- ( Open the file config.inc.php in your favorite editor and change the values for host, user, and password to fit your environment. Read Documentation.txt file for the details.)
./config.inc.php
- Open the file www.your-host.com/phpMyAdmin/index.php in your browser.
MySQL Import File / Database Command
If database customer does not exists, first create it and than import it as follows:
$ mysql -u root -p -e 'create
database customer;'
OR
$ mysql -u root -p customer < /var/www/html/device/customer.sql (backup data location)
$ mysql -u root -p customer < /var/www/html/device/customer.sql (backup data location)
Creating A Backup
The mysqldump command is used to create textfile “dumps” of
databases managed by MySQL. These dumps are just files with all the SQL
commands needed to recreate the database from scratch.If you want to back up a single database, you merely create the dump and send the output into a file, like so:
mysqldump
–u root –p
database_name
>
/location/
database_name.sql
Multiple databases can be backed up at the same time:
mysqldump --databases database_one
database_two > two_databases.sql
It is also simple to back up all of the databases on a server:
mysqldump --all-databases >
all_databases.sql
Restoring a Backup
Since the dump files are just SQL commands, you can restore the database backup by telling mysql to run the commands in it and put the data into the proper database. mysql database_name < database_name.sql
If you are trying to restore a single database from dump of all the databases, you have to let mysql know like this:
mysql --one-database database_name <
all_databases.sql
|
No comments:
Post a Comment