Mysql How Tos

What database you offer?

Ans: We offer MySql database.
 


How many database we can create? 

Ans: Number of databases available depends on web-hosting package you have chosen.

Bronze: 5 Silver: 15 Gold: 25 Platinum: Unlimited


How to create new data base?

In order to create new database, follow the steps below:

Login to the control panel of the account.
Click on MySql on left navigation bar.
In right hand side panel, enter "User" and "Password" you want to use. Then, click on "Create" button.
Then, enter "Database name" you want to use. Then, select the user you want to use. And then click on "Create" button.


How to reset database user password?
In order to create new database, follow the steps below:

Login to the control panel of the account.
Click on MySql on left navigation bar.
In right hand side panel, enter new "Password" against the User for whom you want to reset password. Then, hit "Save".


Is there GUI or phpmyadmin for administering database?
We provide phpmyadmin GUI interface for administering databases. To access phpmyadmin, follow the steps:

Login to the control panel of the account.
You will be able to launch phpmyadmin from there.
Use database username and password to login to phpmyadmin.

 

How to import and export MySQL database via Command Line?

If you look around, today a business who is having a website and have high web traffic to that website, they use dedicated hosting services. And the reason why they use dedicated server is that it has the better capacity to handle more web traffic. Not only that with dedicated server hosting you also get amazing resources where you can fully utilize it. And when you buy a dedicated server for your website you will be provided with the root access to your server. So by having the root access to the server you can easily install, updated and run any of the application your server. Using a dedicated server for your website gives you a lot more advantages than in shared hosting environment.

 

So today if you are having a website and now if you are using a dedicated server for that website and if you are looking for information on how to import and export MySQL database via command line on a dedicated server then here the complete solution for it.

 

Follow the below steps to import and export MySQL database via command line on a dedicated server:

To Export MySQL database

>> Log into your SSH

>> Now you have to use the cd command to navigate to the directory where you have stored your user's access

 

cd /var/www/vhosts/testdomain.com/httpdocs

>> Once you are there in that directory now you have to export the data by using this command

 

mysqldump --add-drop-table -u admin -p`cat /etc/psa/.psa.shadow` dbname > dbname.sql

>> Now you will be prompted for your database password. And next click on enter.

>> Now you can download the resulting SQL file. Once you are done with the downloading process now you need to connect with the FTP to the directory where you created the dump file and download it.

 

To Import MySQL database  

>> Log into your SSH

>> Now use the below command cd to navigate into the directory where you have stored the file.

 

cd /var/www/vhosts/example.com/httpdocs/

>> Now to import the database by inserting the following command

 

mysql -u admin -p`cat /etc/psa/.psa.shadow` dbname < dbname.sql

or

mysql -u admin -p`cat /etc/psa/.psa.shadow` dbname -e 'source dbname.sql'

>> Now it will ask for the password type and click enter. Now your database will import.

 

How to connect to mysql databases using PHP on Linux?

In this article we will explain you how to establish a mysql connection using php on a web page, connecting to a mysql table and retrieving the results and displaying them back on the web page.

 

//Connect To Database

$host="hostingraja.net";

$user="your_dbuser";

$pass="your_dbpass";

$dbname="your_dbusername";

$usertable="your_tablename";

$field = "your_field";

$connection = mysql_connect($host, $user, $pass);

mysql_select_db($dbname, $connection);

 

// Check If Record Exists or not

 

$query = "SELECT * FROM $usertable";

 

$result = mysql_query($query);

 

if($result)

{

while($row = mysql_fetch_array($result))

{

$name = $row["$yourfield"];

echo "Name: ".$name."

";

}

}

?>