1) GUI option
You can use Toad for MySQL Freeware from here.
To take an export that creates inserts for a specified set of data, after creating a connection to your mysql database, you can choose Tools->Export->Export Wizard
Click Next, then Add Button
Choose query as the Export category and then type your SQL statement for one of the tables
SELECT col1, col2 ...
FROM table_name
WHERE tool_id='xyz'
Then Click next - choose SQL SCRIPT any other relevant options
Choose file as the output
Repeat this for as many tables as required
Then execute it to create a set of insert scripts.
You can take a structure export either using TOAD or phpmyadmin and the combination should give you what you are looking for which i assume is a cut down set of data for a test environment.
2) Command line option
Use mysqldump at the command line and list all tables that have the tool_id column
mysqldump -t -u [username] -p test mytable anothertable --where="tool_id = 1"
This should generate a set of insert statements and as above, if you load these scripts into an empty schema exported with phpmyadmin using structure only, it should give you what you need.
You most likely have a .my.cnf
file in your home directory, which is specifying a password.
The clue here is that when you did not specify a password (sudo -u root
), the error message is still saying that you did.
Best Answer
Two possible problems
-p
option. Without-p
the client will not prompt for a password and will attempt to connect without oneGRANT ALL ON *.* TO root@'%' IDENTIFIED BY '...';
)