Home Contact Us Search

[ Order a Server ] [ Server Support ]


[ Getting Started ] [ Server Help ] [ Add on Help ] [ Solution ] [ Trouble Shooting ]

PLEASE NOTE, THIS IS VERY OLD ARCHIVE INFORMATION AND MAY NOT FUNCTION ON NEW SERVERS

Installing MySQL

To install MySQL, connect to your Virtual Server via Telnet or SSH and run the MySQL installation script that matches your Virtual Server O/S:

% vinstall mysql

This command will automatically install all the necessary files for you to run MySQL. It will also start the mysql daemon running on your Virtual Server and setup the Virtual Server to restart the mysql daemon whenever your Virtual Server's host server reboots.

Starting MySQL

To use the MySQL client type:
% mysql -u root

This command will start the MySQL client as the root user. You can add more users by following the directions in section:
MySQL Documentation: 4.3.5 Adding New Users to MySQL

Please note, YOU are responsible for reading the MySQL manual and insuring your MySQL databases are secure.

The following is recommended to setting an initial password to prevent others from accessing your databases without authenticating themselves. At the shell prompt type:

% mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('mypassword') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

Now log back in and test the new password you set for the root user:

% mysql -u root -p
Enter password: mypassword

Replace 'mypassword' in this example with your desired password

You can add another "user" to your MySQL database with this command:
mysql>GRANT ALL PRIVILEGES ON *.*
-->TO DESIREDUSERNAME@localhost
-->IDENTIFIED BY 'mypassword'
-->WITH GRANT OPTION;

Using the last example when you are, for example, using your PHP scripts to access your MySQL databases you will need to supply login information such as:

$DBHost="localhost";
$DBUser="DESIREDUSERNAME";
$DBPass="mypassword";

To create a new mysql database, login:

% mysql -u root -p
Enter password: mypassword

mysql>create database DBNAME;

Replace "DBNAME" with your desired mysql database name.

To delete a mysql database:

mysql>drop database DBNAME;

To show all current databases: (note, you type this at just shell prompt, not mysql prompt )

shell>mysqlshow

It will show something like this...

server% mysqlshow
+-----------+
| Databases |
+-----------+
| mysql        |
| test            |
+-----------+
server%

If you have already created a database and want to give access rights to a specific user to "that" database only, then you should first read Section 6.11 of the manual. The following is an example directly from the manual:

Allow a connection from 'localhost' for user: jimbob with password 'mypassword' and access to the 'mystuff' database only:

1. Login:

% mysql -u root -p
Enter password: mypassword

2. Create database:

mysql>create database mystuff;

3. Set username password:

mysql>GRANT ALL PRIVILEGES
-->ON mystuff.*
-->TO jimbob@localhost
-->IDENTIFIED BY 'mypassword';

You can then allow this particular user to use PHP and access a mysql database with this php/mysql information:

$connect = mysql_connect("localhost", "jimbob","mypassword");

An excellent PHP program which can GREATLY reduce your MySQL database creation and manipulation time can be found by clicking here: phpMyAdmin

Should you ever need to restart mysql from the command prompt, you may do so using the following command:

%cd
%cd etc
%sh rc

This will execute the start command for mysql located in the /etc/rc file.

Documentation

Manpages are available on each Virtual Server host server and can be accessed by typing the following during a telnet session with your Virtual Server:
% man mysql

PLEASE NOTE, THIS IS OLD ARCHIVE INFORMATION AND MAY NOT FUNCTION ON NEW SERVERS