Actions

Difference between revisions of "How to apply a .sql file to a database"

From Joomla! Documentation

m (Using phpMyAdmin)
m (fixing links)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Using phpMyAdmin =
+
==Using phpMyAdmin==
Login to your MySQL database via phpMyAdmin [http://www.phpmyadmin.net]. 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.
+
Login to your MySQL database via [http://www.phpmyadmin.net phpMyAdmin]. 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 =
+
==Using MySQL Query Browser==
Login to your MySQL database via MySQL Query Browser [http://www.mysql.com/products/tools/query-browser/]. 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".
+
Login to your MySQL database via [http://www.mysql.com/products/tools/query-browser/ MySQL Query Browser]. 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!) =
+
==Using the command line MySQL client (advanced!)==
MySQL by default ships with a command line client [http://dev.mysql.com/doc/refman/5.0/en/mysql.html] that enables access to MySQL databases. Change to the directory containing a copy of the script file (e.g. /installation/sql/mysql). Connect to your mysql database with the tool (e.g. ''mysql --username=joomla --password=password joomla_database_name'') and then run the script using "\. scriptname.sql", for example: "\. diff_rc3_to_rc4.sql".
+
MySQL by default ships with a [http://dev.mysql.com/doc/refman/5.0/en/mysql.html command line client] that enables access to MySQL databases.
 +
# Change to the directory containing a copy of the script file. For example,
 +
#:<source lang="bash">cd /public_html/installation/sql/mysql</source>
 +
# Use the tool to connect to your Joomla! database and use a redirection operator ("<") to take commands from the .sql file. For example,
 +
#:<source lang="bash">mysql --user=name joomla_database_name < diff_rc3_to_rc4.sql</source>
 +
#: 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).
 +
 
 +
[[Category:Database]]

Latest revision as of 21:57, 19 January 2014

Using phpMyAdmin

Login to your MySQL database via phpMyAdmin. 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

Login to your MySQL database via MySQL Query Browser. 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!)

MySQL by default ships with a command line client 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).