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