How to manage MySQL databases?
Published: 2005-08-03
MYSQL Database Management Method ①:
You can log in directly at: http://mysql.myhostadmin.net/ to manage it,
MYSQL Database Management Method ②:
First download the PhpMyAdmin software, extract this package, and find one of the files: config.inc.php
(or such as config.*, etc. The filename may vary depending on the phpmyadmin version)
Modify the following configuration:
$cfgServers[1]['host'] = 'localhost'; // MySQL hostname
$cfgServers[1]['port'] = ''; // MySQL port - leave blank for default port
$cfgServers[1]['socket'] = ''; // Path to the socket - leave blank for default socket
$cfgServers[1]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')
$cfgServers[1]['stduser'] = ''; // MySQL standard user settings (this user must have read-only
$cfgServers[1]['stdpass'] = ''; // access to the "mysql/user" and "mysql/db" tables)
$cfgServers[1]['adv_auth'] = FALSE; // Use advanced authentication?
$cfgServers[1]['user'] = 'alintest'; // MySQL user
$cfgServers[1]['password'] = 'alintest'; // MySQL password (only needed with basic auth)
$cfgServers[1]['only_db'] = 'alintest'; // If set to a db-name, only this db is displayed at left frame
Then FTP to your website, create a directory named phpmyadmin under wwwroot, upload all phpmyadmin files to that directory, and visit http://www.yourdomain.com/phpmyadmin to manage the database.
After creating the database, be sure to move these phpadmin files away; otherwise anyone can manage the user's database.
If you use PHP programming, you can use the following code to connect to the database:
<?php
$database = "alintest";
$user = "alintest";
$password = "alintest";
$link = mysql_connect ("localhost", $user, $password)
or die ("Could not connect");
mysql_select_db($database, $link);
..........
mysql_close ($link);
?>
If you use Perl programming, you can use the following code to connect to the database:
#!/usr/bin/perl
use DBI;
$database = "alintest";
$user = "alintest";
$password = "alintest";
$dbh = DBI->connect("DBI:mysql:$database", $user, $password);
..........
$rc = $dbh->disconnect;
If you need mod_perl functionality,
you can visit http://www.youdromain.com/perl/yourcgi.cgi
Change the ordinary /cgi-bin/ to /perl/;
The mod_perl CGI directory and the ordinary CGI directory are the same, both under wwwroot/cgi-bin.
Example:
Upload an env.cgi program to the wwwroot/cgi-bin directory:
If accessed in the ordinary way, the URL is: http://www.yourdomain.com/cgi-bin/env.cgi
If accessed via mod_perl, the URL is: http://www.yourdomain.com/perl/env.cgi
