UKLINUX NET Support - Support for mysql databases
UKLINUX.NET

Services
Sign Up
Upgrade
My Account
Status
Support
Domain Reg.
Colocation

PCs & Software
Buy Linux PCs & Software

Information
Campaigns
Community
Hot Shops
LUGs
News
Whois
Today is Wed 07 Jan, 2009
Once you have a MySQL database set up on the uklinux.net server - you can administer it, ie create tables etc using phpmyadmin located at www.uklinux.net/phpmyadmin

We do not allow direct connection to mysql on the server.

The database name will normally be the same as your username, unless your username is more than 16 characters long. Your password for accessing mysql either in scripts or using phpmyadmin will either have been notified to you or you will have set it.

Most of your database work should be done using php or perl scripts. phpmyadmin is only available for maintenance purposes. In general everything that you can do using phpmyadmin can also be done in a php or perl script. Within scripts you should always use 'localhost' for the host.

Your mysql tables are stored in a subdirectory /mysql of your webspace. Please do not try to alter any of the files in this area or to access the files directly as your MySQL database would be likely to get corrupted.

The maximum user space available to you is 20 MB, that includes all web content and databases.

Making a backup of your MySQL Database

Mysql offers a very simple and very easy to use facility to create a backup of your database by dumping all the descriptions and data needed to recreate it into a text file.

To use this you need to call the mysqldump command which you will have to do via a CGI script on our servers.

As you are doing this via a CGI script the actual command will be run by the web server user account rather than your account so it is necessary for you to create a directory in your home area for this and make sure it is world writable using the command "chmod 707 [dir]" where [dir] is the relevant directory.

Then use a script like this (assuming the directory you used is tmp/ and remembering to replace username and password with the right values for your mysql database login):

mysqlexport.cgi - chmod to 705
------------- cut ---------------
#!/bin/bash

FILE=tmp/backup.sql
NAME=username
PASS=password
DB=dbname

echo "Content-type: text/plain"
echo
echo "Tried to export file: "$FILE

/usr/bin/mysqldump --quote-names -u $NAME --password=$PASS $DB > $FILE
 
------------- cut ---------------

Uploading an existing MySQL Database

Please do not try to upload mysql files from another server onto ours. It will not work.

Instead if you have an existing MySQL database elsewhere that you would like to import to a database on our servers you need to follow these instructions:

1. Firstly, if you do not already have a database for your account create one using the facility for this in the MyAccount service at https://www.uklinux.net/myaccount/

2. Once you have created your database you can make a backup of you existing database by using the mysqldump command. This will create a file containing all of the SQL commands necessary to quickly and easily create a copy of the tables and, optionally, data in your UKLINUX database.

3. To load the data into your database you can use the following script which you will need to upload to your UKLINUX web space along with the dumpfile and execute via a browser (change the names and password, cut & paste the script between the markers):

mysqlimport.cgi - chmod to 705
------------- cut ---------------
#!/bin/bash

FILE=test.sql
NAME=username
PASS=password
DB=dbname

echo "Content-type: text/plain"
echo
echo "Tried to import file: "$FILE

/usr/bin/mysql -u $NAME --password=$PASS $DB < $FILE

------------- cut ---------------
For further information on mysql take a look at www.mysql.com

Apache WebServer Powered by PHP
©2007 UKLINUX.NET (Uklinux Ltd) - S5