एक फाइल बनाएं जिसमें केवल mysql रूट पासवर्ड हो और केवल रूट ही पढ़ सके।
# ls -l /root/.mysqlpw
-rw------- 1 root root 7 2013-08-19 13:24 /root/.mysqlpw
आप के साथ एक डेटाबेस आयात कर सकते हैं
# mysql -u root -p`cat /root/.mysqlpw ` yourdatabase < databasedump.sql
या आपको डेटाबेस से कनेक्ट करें और mysql कमांड जारी करें
# mysql -u root -p`cat /root/.mysqlpw ` yourdatabase
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20460
Server version: 5.1.63-0ubuntu0.10.04.1 (Ubuntu)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| yourdatabase |
+--------------------+
3 rows in set (0.00 sec)
mysql> show tables;
...