This command string should look familiar:

  • mysql -u root -p

    mysql -u root -p us_presidents < ./backups/us_presidents.sql

    mysql -u root -p establishes a connection to the MySQL server using the MySQL client. The connection is made using the root user account and password.

  • us_presidents

    mysql -u root -p us_presidents < ./backups/us_presidents.sql

    us_presidents is the database you want to pipe data into.

  • <

    mysql -u root -p us_presidents < ./backups/us_presidents.sql

    Similar to the > pipe we used to backup the database, the < will read text from a file and pipe it into the MySQL server.

  • ./backups/us_presidents.sql

    mysql -u root -p us_presidents < ./backups/us_presidents.sql

    us_presidents.sql is the file in the backups directory that you backed up your us_presidents database to.

    Now you're just reading it back into the us_presidents database on the MySQL server.

Want ad-free tutorials like these for classroom use? Get them at Visilearn.com.