Langsung ke konten utama

Postingan

Menampilkan postingan dengan label mysql

Backup database MYSQL (data only, dll)

Backup Data only: mysqldump  -u root -p --protocol=tcp --port=3306 --default-character-set=utf8 --single-transaction=TRUE --skip-triggers DATABASE -t table1 -t table2 -t table3  > data.sql Backup Structure only: mysqldump --no-data -u root -p Database table1 table2 ... > str.sql Backup Data and Structure : mysqldump -u root -p Database -t table -t table ... > data&struk.sql Backup Structure view only: mysql -h hosts -u usernonroot -ppassword --skip-column-names --batch -e "select concat('drop table if exists ', table_schema, '.', table_name,'; create or replace view ', table_schema, '.', table_name, ' as ', view_definition, '; ') as q from information_schema.views where table_schema = 'DATABASE_NAME' " > views.sql && sed -i 's/usernonroot/usernonrootnew/g' views.sql Backup Procedure and Function Only: mysqldump -u root -p -single-transaction=TRUE --routines --no-data --no-create-info=TRUE

Mengatasi Error DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

Jika di mysql mendapatkan error seperti dibawah ini: 1418 (HY000) at line 10185: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) dapat diselesaikan dengan cara: 1. jalan kan di cmd/terminal: SET GLOBAL log_bin_trust_function_creators = 1; 2. Masukan di konfgurasi my.cnf : log_bin_trust_function_creators = 1;

“Copying to tmp table” extremely slow

You may need to try setting certain variables within your session tmp_table_size max_heap_table_size These particular values may be too small for your DB Connection to fulfill the query efficiently. These can be set within as follows: To see what values these settings have currently do the following: SHOW VARIABLES LIKE 'max_heap_table_size'; SHOW VARIABLES LIKE 'tmp_table_size'; To set max_heap_table_size to 64M do the following: SET max_heap_table_size = 1024 * 1024 * 64; To set tmp_table_size to 32M do the following: SET tmp_table_size = 1024 * 1024 * 32; If you cannot set these values within your own session, contact your hosting provider to dynamically set them in your my.cnf. Give it a Try !!!

export mysql to csv with command line

First, I can give you the answer for ONE table: The trouble with all these INTO OUTFILE or --tab=tmpfile (and -T/path/to/directory) answers is that it requires running mysqldump on the same server as the MySQL server, and having those access rights. My solution was simply to use mysql (NOT mysqldump) with the -B parameter, inline the SELECT statement with -e, then massage the ASCII output with sed, and wind up with CSV including a header field row: Example: mysql -B -u root -p dbname -e "SELECT * FROM query;" | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > test.csv output: "id","login","password","folder","email" "8","mariana","xxxxxxxxxx","mariana","" "3","squaredesign","xxxxxxxxxxxxxxxxx","squaredesign","mkobylecki@squaredesign.com" "4","miedziak",

Tutorial Install SQLmap Ubuntu

sqlmap merupakan tools/alat opensource yang mendeteksi dan melakukan exploit pada Bug SQLinjection. dengan melakukan serangan SQL injection, peretas dapat mengambil alih hingga dapat memanipulasi sebuah database di dalam sebuah server. Sebelumnya, apa itu SQL Injection? SQL injection merupakan teknik hacking di mana peretas dapat menyisipkan perintah-perintah SQL melalu URL untuk di eksekusi oleh database. bug atau vulnerability ini terjadi karena kelalian seorang programer atau webmaster dalam melakukan pemograman web seperti tidak difilternya variabel dalam web tersebut. Cara installnya? $ sudo apt-get install git $ git clone https://github.com/sqlmapproject/sqlmap.git Untuk Menjalankannya, $ cd /patch/to/sqlmap/ jalankan dengan perintah dasar $ python sqlmap.py -h << untuk melihat basic options $ python sqlmap.py -u 'http://alamat.com'  contoh lain: $ python sqlmap.py --url=”http://192.168.152.129/dvwa/vulnerabilities/sqli/? id=1&Submit=S

Auto Backup Multiple Database Mysql

Hai. sudah lama tidak menyentuh blog ini. dan lebih parahnya, saya baru ingat jika saya punya blog. hal ini saya temukan ketika saya browsing dengan keywoard konfigurasi proxy server squid lusca  . iseng sih, mumpung ga ada tiket yang masuk ke pekerjaan ku. kemarin saya mendapatkan tugas untuk melakukan backup secara manual kebeberapa server yang ada di kantor saya. males sih, karena kita harus membackup satu persatu. nah, saya akhirnya browsing cara yang enak buat backup multiple database mysql. maka saya temukan script beikut: #!/bin/sh user=user_root_database pass=pass_database host=localhost dir=/patch/to/directory_nya backup(){ date=$(date +%Y%m%d-%H%M) tanggal=$(date +%d) bulan=$(date +%m) tahun=$(date +%Y) if [ ! -d "$dir/$tahun/$bulan/$tanggal/" ]; then mkdir --parents $dir/$tahun/$bulan/$tanggal; fi dump=/usr/bin/mysqldump $dump $dbs -u$user -p$pass -h$host -R -K --triggers> $dir/$tahun/$bulan/$tanggal/$dbs-$date.sql gzip -f $dir/$tahun/$bu