Tags » Mysql

Hacking and SQL Injections

Disclaimer: This post is a little technical code wise for SQL!

A friend of mine asked me a very interesting question the other day which I was quite unqualified to answer but did anyway. 2,003 more words

Computer Programming

PHP dan MYSQL menggunakan PDO

yes,

koneksi menggunakan PDO support berbagai database selain mysql. langsung cek source aj.

$dsn = “mysql:$host=’ ‘,dbname=’ ‘ “;

$conn = new PDO (dsn, user, pass);

7 more words

[sh] get updated database name from MySQL into txt file.

The specific task here: know what databases are running on MySQL using a script on shell “sh” and saving that information on a .txt file. 233 more words

CLI

Belajar MySQL: Syntax

1. Login ke MySQL Server
Gunakan perintah mysql -u root -p , ketika muncul pesan Enter password : , masukkan password MySQL anda. jika Anda pengguna aplikasi XAMP, biasanya password root masih kosong. 648 more words

MySQL

Belajar MySQL: Connect

Langkah 1: Buat Database MySQL

Langkah ini diperlukan ketika Anda belum memiliki database MySQL. Pertama-tama, silakan buat database MySQL melalui cPanel dengan mengikuti tutorial¬†berikut ini… 739 more words

MySQL

MySQL - Index Statistics

Background

Wanted to cover how to review Index Statistics in MySQL.

Overview

The tables that we will be using are:

  1. mysql.innodb_table_stats
  2. mysql.innodb_index_stats

Code

Item Column Explanation Sample Database mysql.innodb_index_stats.database_name Database sakila table mysql.innodb_index_stats.table_name Table actor, film, inventory Index mysql.innodb_index_stats.index_name Index Name PRIMARY, idx_fk_film_id, idx_store_id_film_id Stat Name mysql.innodb_index_stats.stat_name Statistics Name n_diff_pfx01… 857 more words

Technical

DBeaver - Table Relationships

Background

Just wanting to make sure that I am properly tracking table relationships in MySQL.

Code

INFORMATION_SCHEMA

INFORMATION_SCHEMA.KEY_COLUMN_USAGE

Code Sample

set @schema := 'sakila';
set @table := 'inventory';

select 

         case

            when tblKCU.TABLE_NAME = @table then 'References'
            when REFERENCED_TABLE_NAME = @table then 'Referenced'

         end as 'isReferencingOrReferenced'
       , tblKCU.CONSTRAINT_NAME as 'constraint'
       , tblKCU.TABLE_NAME as 'table'
       , tblKCU.COLUMN_NAME as 'column'

       , tblKCU.REFERENCED_TABLE_NAME as 'refTable'
       , tblKCU.REFERENCED_COLUMN_NAME as 'refColumn'

       , tblKCU.ORDINAL_POSITION as 'colPos'

from   information_schema.KEY_COLUMN_USAGE tblKCU

where  tblKCU.TABLE_SCHEMA = @schema

/* Foreign Key Relationship */
and    (

             ( tblKCU.TABLE_NAME = @table )
          or ( tblKCU.REFERENCED_TABLE_NAME = @table )

       )

/* Skip Primary Key */
and    (

              ( tblKCU.TABLE_NAME is not null )
          and ( tblKCU.REFERENCED_TABLE_NAME is not null )

       )

order by       

         tblKCU.TABLE_NAME
       , tblKCU.COLUMN_NAME

       , tblKCU.REFERENCED_TABLE_NAME
       , tblKCU.REFERENCED_COLUMN_NAME

       , tblKCU.CONSTRAINT_NAME       

       , tblKCU.ORDINAL_POSITION

;

… 54 more words
MySQL