SSH MySql Optimization

This is for Mysql Server Optimization. This is can use for server with 1GB RAM. This all command for SSH/ shell connection

First : Login to your SSH root

We must edit /etc/my.cnf for optimize Mysql
backup first your my.cnf

# cp /etc/my.cnf /etc/my.cnf.old

Edit file use nano:

# nano /etc/my.cnf

If your server do not have nano function, you can install it with this :

# yum install nano

Then erase all and replace with this code : Continue Reading

Incoming search terms for the article:

mysql optimize ssh, kloxo optimize mysql, mysql optimization kloxo, mysql optimization ppt, mysql ssh optimize connection commands, Optimization & mysqld 1Gb RAM, optimization kloxo, ssh mysqladmin optimize

How to optimize your Mysql database

optimize your Mysql database, I think this useful for our database.  This is simple way to optimize your Mysql databases

First, login to your cPanel or Kloxo or other admin panel. Go to your phpmyadmin of your database that you want to optimize.

At your phpmyadmin, you can see your database tabel like this. At your phpmyadmin if you see your table databases like this, you can get optimize

Continue Reading

Create Mysql Databases at Kloxo Admin Panel

At Kloxo admin panel, for create mysql database almost same with cPanel. Inside Kloxo admin, click MySql databases at Tab Resources. Then click tab Add Mysql Database.

Fill the form.

Db Name : (Database name) Fill this with your database and also become your User database name
Password and retype password : is your user database password. After we create fill that and create, our new database and user database has been created.

At kloxo, database name and user database is not same with cPanel. At cPanel, our database name will become : cpanelUser_DatabaseName.
At Kloxo our database name same with we created : DatabaseName (without KloxoUser)

Incoming search terms for the article:

kloxo database, kloxo create new database, kloxo create mysql, create database on kloxo, databases in kloxo panel, kloxo create database, how to create a database in kloxo, how to create database in kloxo, kloxo add database, kloxo create a database

create cloud Tag use mysql database

This is other way to list cloud tag using mysql database.

<?php
$rtag = mysql_query("select * from tampilantag limit 50") or die(mysql_error());
if(mysql_num_rows($rtag) >0)
{
while($atagnya = mysql_fetch_array($rtag))
 {
if ($atagnya[dipake]>=18)
$ukuranfont ="18"."px";
else if ($atagnya[dipake]<9)
$ukuranfont ="9"."px";
else
$ukuranfont ="$atagnya[dipake]"."px";
echo"<a href=\"$atagnya[namatag].tag\" style=\"font-size:$ukuranfont\">$atagnya[namatag]</a>"." ";
 }
}
?>

This method will only display 50 Tag list from mysql database. We can change it with we like.

At tampilantag table, we need field :
namatag : variable char
dipake : variable Int

Enjoy it

Incoming search terms for the article:

mysql create cloudtag

Basic for select database and show which row we want to

This is basic for display row of our table that we want to show it.

$nilai = mysql_query( "SELECT * FROM admin WHERE kode='$kode'" ) or die( mysql_error() );
$data = mysql_fetch_array( $nilai );
$nnilai = mysql_num_rows( $nilai );

for display array of our row “WHERE kode= $kode “, use “$data[table_field]”

Example : admin table field contains : ID , username, password
for show the result :

ID Admin : <?php echo "$data[ID]"; ?>

Username Admin : <?php echo "$data[username]"; ?>

Password Admin : <?php echo "$data[password]"; ?>

$nnilai is for count row from admin table “WHERE kode= $kode ”

If we place code : <?php eho “$nnilai”; ?> It will show integer number.

Have nice try

Php mysql query for Insert field use PHP

This is  mysql query for insert field to Table.

This is use after form post/ form get. I usually use form with method “POST”.

And this is simple for insert my form post result to table.

mysql_query( "
insert into bank set
nama_bank = '$_POST[nama_bank]',
no_rekening = '$_POST[no_rekening]',
an_rekening = '$_POST[an_rekening]',
bank_cabang = '$_POST[bank_cabang]'") or die( mysql_error() );

where

$_POST[nama_bank] is our value for input type with name "nama_bank"
$_POST[no_rekening] value for input name "no_rekening"
$_POST[an_rekening] value for input name "an_rekening"
$_POST[bank_cabang] value for input name "bank_cabang"

So, that PHP is order to insert to table “bank”

field "nama_bank" at our table filled with $_POST[nama_bank]
field "no_rekening" at our table filled with $_POST[no_rekening]
field "an_rekening" at our table filled with $_POST[an_rekening]
field "bank_cabang" at our table filled with $_POST[bank_cabang]

Incoming search terms for the article:

MySQL and INSERT FIELD

Make file connection Mysql Database

We can first make php file conn.php for set connection to our mysql database.

<?php
/* MySQL configuration */

//enter your MySQL database host name, often it is not necessary to edit this line
$db_host = "localhost";

//enter your MySQL database username
$db_username = "username";

//enter your MySQL database password
$db_password = "password";

//enter your MySQL database name
$db_name = "dbname";

/ ----- do not edit below ------
//conect to db
$conn = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());
$db = mysql_select_db($db_name, $conn) or die(mysql_error());

//start session
session_start();

//get the time
$t = time();

?>

you can copy and paste that code as file : conn.php

How to backup and restore big size Mysql Database

a. Backup data
Backup database

$ mysqldump -u root -h localhost -pmypassword mydatabase > mydatabase.sql

for save at folder root  :

$ mysqldump -u root -h localhost -pmypassword mydatabase > /root/mydatabase.sql

for save it and get zipped :

$ mysqldump -u root -h localhost -pmypassword mydatabase | gzip -9 > mydatabase.sql.gz

b. Restore data

$ mysql - u root -pmypassword mydatabase < mydatabase.sql

if only for restore data to database :

$ mysqlimport - u root -pmypassword mydatabase mydatabase.sql

Incoming search terms for the article:

big size mysql database, mysql restore script big size