Langsung ke konten utama

Postingan

Backup Mysql ALL Database with Specific Methods ( #! /bin/bash)

#! /bin/bash # backup-mysql.sh # # Craig Sanders <cas@taz.net.au> # this script is in the public domain.  do whatever you want with it. MYUSER="root" MYPWD="PASSWD" ARGS="--single-transaction --flush-logs --complete-insert" DATABASES=$( mysql -D mysql --skip-column-names -B -e 'show databases;' | egrep -v 'information_schema' ); BACKUPDIR=/var/backups/mysql YEAR=$(date +"%Y") MONTH=$(date +"%m") DAY=$(date +"%d") DATE="$YEAR-$MONTH/$YEAR-$MONTH-$DAY" mkdir -p $BACKUPDIR/$DATE cd $BACKUPDIR/$DATE for i in $DATABASES ; do   echo -n "backing up $i: schema..."   mysqldump $ARGS --no-data -u$MYUSER -p$MYPWD $i > $i.schema.sql   echo -n "data..."   mysqldump $ARGS --skip-opt --no-create-db --no-create-info -u$MYUSER -p$MYPWD $i > $i.data.sql   echo -n "backup full databases"   mysqldump $ARGS -u$MYUSER -p$MYPWD $i > $i.full.sql   echo -n "Backup views"

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

Switch PHP version

Interactive switching mode sudo update-alternatives --config php Manual Switching From PHP 5.6 => PHP 7.1 Default PHP 5.6 is set on your system and you need to switch to PHP 7.1. Apache: $ sudo a2dismod php5 . 6 $ sudo a2enmod php7 . 1 $ sudo service apache2 restart Command Line: $ sudo update - alternatives -- set php / usr / bin / php7 . 1 From PHP 7.1 => PHP 5.6 Default PHP 7.1 is set on your system and you need to switch to PHP 5.6. Apache: $ sudo a2dismod php7 . 1 $ sudo a2enmod php5 . 6 $ sudo service apache2 restart Command Line: $ sudo update - alternatives -- set php / usr / bin / php5 . 6

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 !!!

ORA-00257: archiver error. Connect internal only | Automatic archival Disabled

Then as root switch to this user so have to have all the oracle variables in your path, You MUST log on as sysdba that's the only internal user allowed to access the database in such situations. eg if the owner owner/user is oradba # su - oradba Now you can invoke sqlplus $sqlplus /nolog SQL>conn / as sysdba SQL> archive log list; Database log mode        Archive Mode Automatic archival        Enabled Archive destination        USE_DB_RECOVERY_FILE_DEST Oldest online log sequence     482 Next log sequence to archive   482 Current log sequence        487 Check the Archive destination and delete all the logs SQL> shutdown immediate Database closed. Database dismounted. SQL> startup mount ORACLE instance started. Total System Global Area 3240239104 bytes Fixed Size     2217712 bytes Variable Size 2835351824 bytes Database Buffers   385875968 bytes Redo Buffers    16793600 bytes Database mounted. SQL> alter database noar

install php5.3 ubuntu 14.04, 16.04, 18.04 with cgi not fcgi

Halo, kali ini saya akan membagikan tutorial mudah untuk compile dan install php5.3 di ubuntu 14.04, btw.. di 18.04 juga bisa sebenernya, asalakan perinsipnya tahu.  kenapa saya pake cgi tidak fcgi? ya karena lebih enteng dari fcgi, dan fpm. nah biasanya, kita sering dihadapkan dengan kondisi dimana diharuskan memasang aplikasi lama, di server yang OS nya ke-kinian. oke.. bisa dipahami? untuk install php5.3 diubuntu, diperlukan keahlian dalam mengatasi error dan mencarinya di google. yuk mulai 1. Unduh file compile PHP wget -O php-5.3.29.tar.gz http://de1.php.net/get/php-5.3.29.tar.gz/from/this/mirror 2. install depedensi yang dibutuhkan: apt-get install apache2 apt-get install build-essential apt-get install libxml2-dev apt-get install libcurl4-openssl-dev pkg-config apt-get install libbz2-dev apt-get install libjpeg-turbo8-dev apt-get install libpng-dev apt-get install libfreetype6-dev apt-get install libmcrypt-dev libreadline-dev apt-get install libmysqlclient15-de