RSS

Mengatasi error ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Cara mengatasi error ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 


1. buka configurasi my.cnf, edit seperti dibawah ini kemudian simpan!
 
    # The following options will be passed to all MySQL clients
    [client]
    #socket      = /tmp/mysql.sock
    socket        = /var/run/mysqld/mysqld.sock

    # Here follows entries for some specific programs

    # The MySQL server
    [mysqld]
    #socket      = /tmp/mysql.sock
    socket        = /var/run/mysqld/mysqld.sock

2. Buat folder mysqld/  di direktori /var/run/ :

    sudo mkdir -p /var/run/mysqld/

3. Then create a mysqld.pid file with touch:

    sudo touch /var/run/mysqld/mysqld.pid

4. Next create a mysqld.sock file with touch:

    sudo touch /var/run/mysqld/mysqld.sock

5. Now change the ownerships of the directory and files to mysql:mysql like this:

    sudo chown mysql:mysql -R /var/run/mysqld

6. And restart MySQL like this to get those files set and created:

    sudo service mysql restart





  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Install mysql 5.1 on ubuntu 23.10 server

#!/bin/bash
# Run as root

set -e

apt-get update
apt-get install -y build-essential
apt-get install -y libncurses5-dev
useradd mysql

cd
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.73.tar.gz
tar xzvf mysql-5.1.73.tar.gz
cd mysql-5.1.73

./configure \
'--prefix=/usr' \
'--exec-prefix=/usr' \
'--libexecdir=/usr/sbin' \
'--datadir=/usr/share' \
'--localstatedir=/var/lib/mysql' \
'--includedir=/usr/include' \
'--infodir=/usr/share/info' \
'--mandir=/usr/share/man' \
'--with-system-type=debian-linux-gnu' \
'--enable-shared' \
'--enable-static' \
'--enable-thread-safe-client' \
'--enable-assembler' \
'--enable-local-infile' \
'--with-fast-mutexes' \
'--with-big-tables' \
'--with-unix-socket-path=/var/run/mysqld/mysqld.sock' \
'--with-mysqld-user=mysql' \
'--with-libwrap' \
'--with-readline' \
'--with-ssl' \
'--without-docs' \
'--with-extra-charsets=all' \
'--with-plugins=max' \
'--with-embedded-server' \
'--with-embedded-privilege-control' \
CXXFLAGS="-Wno-narrowing -fpermissive"

make
make install

mkdir -p /etc/mysql
mkdir -p /var/lib/mysql
mkdir -p /etc/mysql/conf.d
echo -e '[mysqld_safe]\nsyslog' > /etc/mysql/conf.d/mysqld_safe_syslog.cnf
cp /usr/share/mysql/my-medium.cnf /etc/mysql/my.cnf
sed -i 's#.*datadir.*#datadir = /var/lib/mysql#g' /etc/mysql/my.cnf
chown mysql:mysql -R /var/lib/mysql

mysql_install_db --user=mysql
mysqld_safe -user=mysql &
/usr/bin/mysql_secure_installation

cp /usr/share/mysql/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
update-rc.d mysql defaults

Reff: https://gist.github.com/huangqiheng/7fbfcd7f4f97255447713ec6e9e85257
jika hasil restore dari mysql 5.5 ke mysql 5.1 gagal, tambahkan script ini di my.cnf 
log_bin_trust_function_creators = 1
restart mysql => sudo /etc/init.d/mysql restart 

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Install Mysql 8 Ubuntu 23

sudo apt install mysql-server

sudo systemctl start mysql
sudo systemctl status mysql


sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password12345';

mysql_secure_installation
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

bind-address            = 127.0.0.1 => rubah ke IP server mysql

sudo systemctl restart mysql

#Login to MySQL console using root
mysql -u root -p

#In the MySQL console, we will create a new user called dhani with password password123
CREATE USER 'dhani'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password123';

#Optionally, we can also grant this new user to access all the databases
GRANT ALL PRIVILEGES ON *.* TO 'dhani'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

#Log in to MySQL Console as root
mysql -u root -p

#Create a new user
CREATE USER 'dhani'@'%' IDENTIFIED WITH mysql_native_password BY 'password123';
GRANT ALL PRIVILEGES ON *.* TO 'dhani'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Set IP Address Ubuntu 23

Install Net-Tools
apt install net-tools

Masuk ke direktory netplan
root@server:/# cd /etc/netplan/
root@server:/etc/netplan#
pico 50-cloud-init.yaml

#network:
#    ethernets:
#        eno1:
#            dhcp4: true
#    version: 2

# create new
network:
  ethernets:
    # interface name
    enp1s0:
      dhcp4: false
      # IP address/subnet mask
      addresses: [10.0.0.30/24]
      # default gateway
      # [metric] : set priority (specify it if multiple NICs are set)
      # lower value is higher priority
      routes:
        - to: default
          via: 10.0.0.1
          metric: 100
      nameservers:
        # name server to bind
        addresses: [10.0.0.10,10.0.0.11]
        # DNS search base
        search: [srv.world,server.education]
      dhcp6: false
  version: 2

# apply changes
root@localhost:~# netplan apply

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Dinamically Populate Listview VB6 any database

Public Sub dinamicLv(strSql As String, lv As ListView)
Dim rs As New MYSQL_RS
Dim i, j, k As Integer
    
    With lv
        .view = lvwReport
        .Gridlines = True
        .FullRowSelect = True
        .HotTracking = True
        .ColumnHeaders.Clear
        .CheckBoxes = True
        
        'Ambil Header
        rs.OpenRs strSql, db
            If rs.EOF = False Then
                lv.ColumnHeaders.Clear
                lv.ColumnHeaders.Add , , 0, 1
                For i = 0 To rs.FieldCount - 1
                    lv.ColumnHeaders.Add , , rs.Fields(i).Name
                Next i
            End If
        rs.CloseRecordset
        
        'Ambil Data
        rs.OpenRs strSql, db
            If rs.EOF = False Then
                lv.ListItems.Clear
                rs.MoveFirst
                
                Do While Not rs.EOF
                Set List = lv.ListItems.Add
                    For j = 1 To i
                        List.SubItems(j) = rs.Fields(j - 1).Value
                    Next
                rs.MoveNext
                Loop
            End If
        rs.CloseRecordset
    End With
        
End Sub

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Install Whatsapp API ubuntu server 20

1. Siapkan beberapa hal berikut: 

    NodeJS 18, Python 3, pip dan npm

2. Install NodeJS 18
    curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - 
    
3. Install Python dan library
    apt-get install python3-pip
    pip install mysql-connector-python
    pip install requests
    
    cd Whatsapp-WHMCS
    npm install
    npm update

4. Clone Git
    git clone https://github.com/Intprism-Technology/Whatsapp-WHMCS.git

5. Test QRscan 
    cd Whatsapp-WHMC 
    node index.js

    Jika error menjalankan index.js, jalankan berikut:
    apt install libxkbcommon0 libxshmfence1 ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0  libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils

6. Test Kirim 
    cd whmcs
    pico send.py
    import requests
    url = 'http://127.0.0.1:8080/api/send'
   data = {'phone': '+6281xxxxxxxxx', 'message': 'Test kirim dari server WA'}

   ===> simpan dengan ctrl+x 

7. Jalankan file 
    python3 send.py
  

    

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Permission User

Add permission data
chown -R www-data:www-data /image

routing gateway proxmox
root@stompr:~# ip route show
192.168.10.0/24 dev vlan10 proto kernel scope link src 192.168.10.10

root@stompr:~# ip route add default via 192.168.10.1 dev vlan10
root@stompr:~# ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=58 time=20.7 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=58 time=21.9 ms
^C
--- 1.1.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 3ms
rtt min/avg/max/mdev = 20.681/21.298/21.916/0.634 ms


To activate Windows 11 with CMD, follow these steps:

  • Open a CMD as administrator (Press Win+S to start searching, enter CMD, and run as administrator via the right button (see how it’s done).
  • slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX Copy and paste the command to install a new key. ( You can use this universal key, if this one is not suitable, then look at other Windows 11 activation keys for your edition on our website.) The result of the executed command should be a message about the successful installation of the product code.
  • slmgr /skms kms.digiboy.ir Copy and paste the following command to connect to the activation server. (You can also use kms.xspace.in or zh.us.to.
  • slmgr /ato Copy and paste the following command to activate Windows 11. (The result should be a successful activation message.)

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Config My.cnf Mysql 5.5


[client]

port = 3636
socket = /tmp/mysql.sock

[mysqld]
port = 3636
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

#tambahan
skip-name-resolve
log_bin_trust_function_creators = 1

bind-address = xxx.xxx.xxx.xxx

log-bin=mysql-bin
binlog_format=mixed
server-id = 1

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

innodb_force_recovery = 1

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Install Mysql 5.5 ubuntu server 16

  1. Uninstall any existing version of MySQL
    sudo rm /var/lib/mysql/ -R
  2. Delete the MySQL profile
    sudo rm /etc/mysql/ -R
  3. Automatically uninstall mysql
    sudo apt-get autoremove mysql* --purge
    sudo apt-get remove apparmor
  4. Download version 5.5.51 from MySQL site
    wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz
  5. Add mysql user group
    sudo groupadd mysql
  6. Add mysql (not the current user) to mysql user group
    sudo useradd -g mysql mysql
  7. Extract  to /usr/local
    sudo tar -xvf mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz /usr/local/
  8. Create mysql folder in /usr/local by moving the untarred folder
    cd /usr/local
    sudo mv mysql-5.5.49-linux2.6-x86_64 mysql
  9. Set mysql directory owner and user group
    cd mysql
    sudo chown -R mysql:mysql *
  10. Install the required lib package (works with 5.6 as well)
    sudo apt-get install libaio1
  11. Execute mysql installation script
    sudo scripts/mysql_install_db --user=mysql
  12. Set mysql directory owner from outside the mysql directory
    sudo chown -R root .
  13. Set data directory owner from inside mysql directory
    sudo chown -R mysql data
  14. Copy the mysql configuration file
    sudo cp support-files/my-medium.cnf /etc/my.cnf (mysql 5.5)
    sudo cp support-files/my-default.cnf /etc/my.cnf (mysl 5.6)
  15. Start mysql
    sudo bin/mysqld_safe --user=mysql &
    sudo cp support-files/mysql.server /etc/init.d/mysql.server
  16. Initialize root user password
    sudo bin/mysqladmin -u root password '[your new password]'
  17. Add mysql path to the system
    sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
  18. Reboot!
  19. Start mysql server
    sudo /etc/init.d/mysql.server start
    
  20. Stop mysql server
    sudo /etc/init.d/mysql.server stop
  21. Check status of mysql
    sudo /etc/init.d/mysql.server status
  22. 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
  23. REBOOT!
  24. Now directly use the command below to start mysql if it hasn’t
    sudo service start mysql -u root -p

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Remove Mysql Ubuntu Server

Step by step remove mysql from Ubuntu Server: 

  • sudo systemctl status mysql
  • sudo systemctl stop mysql
  • sudo systemctl status mysql
  • sudo apt purge mysql-server*
  • sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
  • ls /etc/mysql
  • sudo ls /var/lib/mysql
  • sudo rm -r /etc/mysql /var/lib/mysql
  • sudo rm -r /var/log/mysql
  • sudo apt autoremove

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS