thaicosmic.com

หนัง

วันพฤหัสบดีที่ 23 ธันวาคม พ.ศ. 2564

วันอาทิตย์ที่ 19 ธันวาคม พ.ศ. 2564

Install MySQL 5.6.xx on Ubuntu 18.04

 credit : Anthony Orona 

on https://gist.github.com/Ajorona/e44ca0d0e9cfa055976ea91d9a2cba2a

MySQL Download URL

https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.45-linux-glibc2.12-x86_64.tar.gz

Open the terminal and follow along:

  • Uninstall any existing version of MySQL
sudo rm /var/lib/mysql/ -R
  • Delete the MySQL profile
sudo rm /etc/mysql/ -R
  • Automatically uninstall mysql
sudo apt-get autoremove mysql* --purge
sudo apt-get remove apparmor
  • Download version 5.6.45 from MySQL site
wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.45-linux-glibc2.12-x86_64.tar.gz
  • Add mysql user group
sudo groupadd mysql
  • Add mysql (not the current user) to mysql user group
sudo useradd -g mysql mysql
  • Extract it
sudo tar -xvf mysql-5.6.45-linux-glibc2.12-x86_64.tar.gz
  • Move it to /usr/local
sudo mv mysql-5.6.45-linux-glibc2.12-x86_64 /usr/local/
  • Create mysql folder in /usr/local by moving the untarred folder
cd /usr/local/
sudo mv mysql-5.6.45-linux-glibc2.12-x86_64 mysql

  • set MySql directory owner and user group
cd mysql/
sudo chown -R mysql:mysql *
  • Install the required lib package
sudo apt-get install libaio1
  • Execute mysql installation script
sudo scripts/mysql_install_db --user=mysql
  • Set mysql directory owner from outside the mysql directory
sudo chown -R root .
  • Set data directory owner from inside mysql directory
sudo chown -R mysql data
  • Copy the mysql configuration file
sudo cp support-files/my-default.cnf /etc/my.cnf
  • Start mysql
sudo bin/mysqld_safe --user=mysql &
sudo cp support-files/mysql.server /etc/init.d/mysql.server
  • Set root user password
sudo bin/mysqladmin -u root password '[your new password]'
example : sudo bin/mysqladmin -u root password '123456'
  • Add mysql path to the system
sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
  • Reboot!

  • Start mysql server

sudo /etc/init.d/mysql.server start
  • Stop mysql server
sudo /etc/init.d/mysql.server stop
  • Check status of mysql
sudo /etc/init.d/mysql.server status
  • Enable myql on startup
sudo update-rc.d -f mysql.server defaults

*Disable mysql on startup (Optional)

sudo update-rc.d -f mysql.server remove
  • REBOOT!

  • Now login using below command, start mysql server if it's not running already

mysql -u root -p
  • [Addict] Change port and remote access
    • sudo nano /etc/my.cnf
      	[mysqld]
      		bind-address = 0.0.0.0
      		port = 3333
      sudo /etc/init.d/mysql.server restart
      mysql --port=3333 -u root -p
      UPDATE mysql.user SET Password=PASSWORD('123456') WHERE User='root';
      UPDATE mysql.user SET authentication_string=PASSWORD('123456') WHERE User='root';
      GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY '123456';
      FLUSH PRIVILEGES;
      sudo /etc/init.d/mysql.server restart


    last

     mysql --port=3333 -u root -p

    sudo nano /etc/my.cnf

    sudo /etc/init.d/mysql.server restart

    วันเสาร์ที่ 18 ธันวาคม พ.ศ. 2564

    mysql-backup-jhcisdb.sh

     # !/bin/sh

        /usr/local/mysql/bin/mysqldump --skip-comments --default-character-set=utf8 --routines --lock-tables=false --compatible=no_key_options -u root -p123456 jhcisdb > /home/jhcis/Google\ Drive/jhcisbackup/jhcisdb-03301.$(date -d "+0 day" "+%Y-%m-%d").sql


    cd /home/jhcis/Google\ Drive/jhcisbackup/

    FILE1=jhcisdb-03301.$(date -d "+0 day" "+%Y-%m-%d").sql

    if [ -f "$FILE1" ]; then

         sudo zip -r jhcisdb-03301.$(date -d "+0 day" "+%Y-%m-%d").zip "$FILE1"

    fi


    cd /home/jhcis/Google\ Drive/jhcisbackup/

    FILE2=jhcisdb-03301.$(date -d "+0 day" "+%Y-%m-%d").zip

    if [ -f "$FILE2" ]; then

         sudo rm -f /home/jhcis/Google\ Drive/jhcisbackup/jhcisdb-03301.$(date -d "-0 day" "+%Y-%m-%d").sql

         sudo rm -f /home/jhcis/Google\ Drive/jhcisbackup/jhcisdb-03301.$(date -d "-32 day" "+%Y-%m-%d").zip

         sudo rm -f /home/jhcis/Google\ Drive/jhcisbackup/jhcisdb-03301.$(date -d "-33 day" "+%Y-%m-%d").zip

    fi

    create-pdf.sh

     # !/bin/sh


    /opt/lampp/bin/php -f /opt/lampp/htdocs/fpdf17/PhpCreatePdf.php

    crontab

     # /etc/crontab: system-wide crontab

    # Unlike any other crontab you don't have to run the `crontab'

    # command to install the new version when you edit this file

    # and files in /etc/cron.d. These files also have username fields,

    # that none of the other crontabs do.


    SHELL=/bin/sh

    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin


    # m h dom mon dow user command

    17 * * * * root    cd / && run-parts --report /etc/cron.hourly

    25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

    47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )

    52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

    0 0-23  * * 0-6 root    /var/jhcis/mysql-backup-jhcisdb.sh >/dev/null 2>&1

    0 0-23  * * 0-6 root    /var/jepidem/runjepidem.sh >/dev/null 2>&1

    0 17-19 * * 0-6 root    /var/jxp18/runjxp18.sh >/dev/null 2>&1

    0 13-14 * * 0-6 root    /var/jautoup/runjauto.sh >/dev/null 2>&

    */5 * * * * root sh /var/jhcis/create-pdf.sh >/dev/null 2>&1

    */5 * * * * root /usr/bin/rsync -a /opt/lampp/htdocs/MyPDF.pdf /home/jhcis/Dropbox/MyPDF.pdf >/dev/null 2>&1

    */5 * * * * root /usr/bin/rsync -a /opt/lampp/htdocs/MyPDF.pdf /home/jhcis/MEGA/MyPDF.pdf >/dev/null 2>&1

    */5 * * * * root /usr/bin/rsync -a /opt/lampp/htdocs/MyPDF.pdf /home/jhcis/'Google Drive'/myPDF/MyPDF.pdf >/dev/null 2>&1

    #

    mysql 5.6.45

     https://gist.github.com/Ajorona/e44ca0d0e9cfa055976ea91d9a2cba2a

    https://cdn.mysql.com/archives/mysql-5.6/mysql-server_5.6.45-1debian9_amd64.deb

    วันศุกร์ที่ 17 ธันวาคม พ.ศ. 2564

    mysql mode

     Solution 1: Remove ONLY_FULL_GROUP_BY from mysql console

    mysql > SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

    วันพุธที่ 15 ธันวาคม พ.ศ. 2564

    วันอังคารที่ 14 ธันวาคม พ.ศ. 2564

    Ubuntu 18.04.6

     PHP 7.2.24

    mySQL 5.7.3.6


    https://www.freshblurbs.com/blog/2007/01/20/disabling-mysql-and-ftp-xampp-linux.html

    วันอาทิตย์ที่ 12 ธันวาคม พ.ศ. 2564

    temp

     sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf

    #

    # The MySQL database server configuration file.

    #

    # One can use all long options that the program supports.

    # Run program with --help to get a list of available options and with

    # --print-defaults to see which it would actually understand and use.

    #

    # For explanations see

    # http://dev.mysql.com/doc/mysql/en/server-system-variables.html


    # Here is entries for some specific programs

    # The following values assume you have at least 32M ram


    [mysqld]

           character-set-server=utf8

           collation-server=utf8_general_ci

    #

    # * Basic Settings

    #

    user = mysql

    # pid-file = /var/run/mysqld/mysqld.pid

    # socket = /var/run/mysqld/mysqld.sock

    # port = 3306

    # datadir = /var/lib/mysql

    # If MySQL is running as a replication slave, this should be

    # changed. Ref https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir

    # tmpdir = /tmp

    #

    # Instead of skip-networking the default is now to listen only on

    # localhost which is more compatible and is not less secure.

    bind-address = 0.0.0.0

    mysqlx-bind-address = 127.0.0.1

    #

    # * Fine Tuning

    #

    key_buffer_size = 16M

    # max_allowed_packet = 64M

    # thread_stack = 256K


    # thread_cache_size       = -1


    # This replaces the startup script and checks MyISAM tables if needed

    # the first time they are touched

    myisam-recover-options  = BACKUP


    # max_connections        = 151


    # table_open_cache       = 4000


    #

    # * Logging and Replication

    #

    # Both location gets rotated by the cronjob.

    #

    # Log all queries

    # Be aware that this log type is a performance killer.

    # general_log_file        = /var/log/mysql/query.log

    # general_log             = 1

    #

    # Error log - should be very few entries.

    #

    log_error = /var/log/mysql/error.log

    #

    # Here you can see queries with especially long duration

    # slow_query_log = 1

    # slow_query_log_file = /var/log/mysql/mysql-slow.log

    # long_query_time = 2

    # log-queries-not-using-indexes

    #

    # The following can be used as easy to replay backup logs or for replication.

    # note: if you are setting up a replication slave, see README.Debian about

    #       other settings you may need to change.

    # server-id = 1

    # log_bin = /var/log/mysql/mysql-bin.log

    # binlog_expire_logs_seconds = 2592000

    max_binlog_size   = 100M

    # binlog_do_db = include_database_name

    # binlog_ignore_db = include_database_name

    วันศุกร์ที่ 10 ธันวาคม พ.ศ. 2564

    mysql8

     https://www.tecmint.com/fix-mysql-error-1819-hy000/

    SET GLOBAL validate_password.length=6;

    SET GLOBAL validate_password.policy=0;

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'Vhere@03301';

    CREATE USER 'root'@'%' IDENTIFIED BY 'Vhere@03301';

    GRANT CREATE ON *.* TO 'root'@'%';

    CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'Vhere@03301';

    CREATE USER 'phpmyadmin'@'%' IDENTIFIED BY 'Vhere@03301';

    sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf


    GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'Vhere@03301';
    FLUSH PRIVILEGES;

    =====================================================

    sudo apt update

    sudo apt install firewalld

    sudo systemctl enable firewalld

    sudo systemctl start firewalld

    sudo firewall-cmd --state

    ========================================

    sudo apt install mate-utils
    mate-search-tool
    ==========================================================
    sudo gedit /etc/phpmyadmin/config.inc.php
    $cfg['Servers'][$i]['port'] = '3333';
    =============================================================
    GRANT DROP ON *.* TO 'root'@'%';
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
    FLUSH PRIVILEGES;
    
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, ALTER, INDEX on *.* TO 'root'@'localhost';
    
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, ALTER, INDEX on *.* TO 'root'@'%';
    
    FLUSH PRIVILEGES; 
    ==========================================================
    sudo gedit /etc/apache2/conf-enabled/phpmyadmin.conf
    ===========================================================
    SELECT 
        user, 
        host, 
        Select_priv, 
        Insert_priv,
        Update_priv,
        Delete_priv,
        Create_priv,
        Drop_priv
    FROM
        mysql.user;
     
    GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'%';
    
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.12';
    ============================================================
    sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf



    วันจันทร์ที่ 15 มีนาคม พ.ศ. 2564

    วันพุธที่ 3 กุมภาพันธ์ พ.ศ. 2564

    คาถาบูชาจ้าวปู่พญานาคาธิบดีศรีสุทโธ คาถาบูชาจ้าวย่านางพญา นาคิณีศรีปทุมมา

     นะโมตัสสะภะคะวะโต อะระหะโต สัมมาสัมพุทธัสสะ

     นะโมตัสสะภะคะวะโต อะระหะโต สัมมาสัมพุทธัสสะ

     นะโมตัสสะภะคะวะโต อะระหะโต สัมมาสัมพุทธัสสะ

    กายะ วาจะ จิตตัง อะหังวันทา นาคาธิบดีศรีสุทโธ วิสุทธิเทวาปูเชมิ

    ทุติยัมปิ กายะ วาจะ จิตตัง อะหังวันทา นาคาธิบดีศรีสุทโธ นางพญานาคิณีศรีปทุมมา วิสุทธิเทวาปูเชมิ

    ตะติยัมปิ กายะ วาจะ จิตตัง อะหังวันทา นาคาธิบดีศรีสุทโธ วิสุทธิเทวาปูเชมิ

    เมตตัญจะมหาลาโภปิโยนาคะ ขันธปริตตัง