How to apply a .sql file to a database

From Joomla! Documentation

Revision as of 06:21, 26 January 2008 by Chris Davenport (talk | contribs) (--user instead of --username. Don't user --password as it's not secure.)

Using phpMyAdmin[edit]

Login to your MySQL database via phpMyAdmin [1]. Select your database. Choose the SQL tab. Enter the code lines into the text box and press Go. You will be provided with the results of the command on this screen.

Using MySQL Query Browser[edit]

Login to your MySQL database via MySQL Query Browser [2]. Double click on your database on the right hand side to select it. Create a new "script" tab and enter the code lines into the text box provided and press "Execute".

Using the command line MySQL client (advanced!)[edit]

MySQL by default ships with a command line client [3] that enables access to MySQL databases.

  1. Change to the directory containing a copy of the script file. For example,
    cd /public_html/installation/sql/mysql
  2. Use the tool to connect to your Joomla! database and use a redirection operator ("<") to take commands from the .sql file. For example,
    mysql --user=name joomla_database_name < diff_rc3_to_rc4.sql
    You will be prompted to enter the password before the command is carried out. Do not use the "--password" option to enter your password on the command line as this is not secure (potentially anyone else logged in to your system can see the password).