Q: Do
you have any examples for interfacing my mSQL2 database with PHP3?
A: One of the best ways to
troubleshoot mSQL2 with PHP3 on a virtual server is to set up a test script
your virtual server. To do this, you can follow these steps:
1) Create the database with the following command from your telnet prompt:
msql2admin create testdb
2) Populate your database. To do so, create a file on your virtual server
that contains the following text:
#
# mSQL Dump (requires mSQL 2.0 Beta 5 or newer)
#
# Host: localhost Database: testdb
#--------------------------------------------------------
#
# Table structure for table 'test'
#
CREATE TABLE test (
name CHAR(30),
age INT
) \g
#
# Dumping data for table 'test'
#
INSERT INTO test VALUES ('John',33)\g
INSERT INTO test VALUES ('Mary',5)\g
INSERT INTO test VALUES ('Clyde',87)\g
1) Name this file something like testdb.dump
2) Install the information with the following command:
msql2 testdb < testdb.dump
3) Create a PHP3 test script to list the
contents of this database.
The following is an example of the contents of this page:
<html>
<head><title>php3 test with msql2
database</title></head>
<body>
<h1>PHP3 test with msql2 database</h1>
<b>List contents of database:</b>
<br><? $results = msql("testdb","select * from
test");
$rows = msql_numrows($results);
$count = 0;
while($count < $rows) {
$data = msql_fetch_array($results);
echo "<b>Name:</b> $data[name]<br>
";
echo "<b>Age:</b> $data[age]<br>
";
$count++;
}
echo msql_error();
?>
</body>
</html>
1) Name the file something like testdb.php3
2) Place this page in your ~/www/htdocs directory, and then test it via the
Web to make sure that it works!
Q: Can
I access MySQL from outside my virtual server?
A: Some customers have requested
access to MySQL from outside of the virtual server using Java JDBC or Window
ODBC. However, this is not possible. For security reasons, TCP/IP
connections to MySQL have been disabled.
Q: I
currently use mSQL but want to switch to MySQL. How do I move my
databases over?
A: First,
run the following command at your virtual server's Telnet or SSH prompt,
where database is the name of the database to export, and table is the table
within the database you are exporting:
msql2export database table > table.txt
Then, run the following command to import the database into MySQL:
mysqlimport --fields-terminated-by=',' database
table.txt
This will create the table "table" in your MySQL database.