Sriram Sanka – My Experiences with Databases & More

Oracle-MySQL-SQL SERVER-Python-Azure-AWS-Oracle Cloud-GCP etc

  • Enter your email address to follow this blog and receive notifications of new posts by email.

  • Total Views

    • 588,546 hits
  • $riram $anka


    The experiences, Test cases, views, and opinions etc expressed in this website are my own and does not reflect the views or opinions of my employer. This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content.Product and company names mentioned in this website may be the trademarks of their respective owners.

Archive for the ‘VM Images’ Category

MySQL – Install(5.7) and Upgrade to (8.0.31) in Ubuntu 18.*

Posted by Sriram Sanka on October 31, 2022


#MySQL #Ubuntu 18.04.6 #Install # Upgrade

You can download OS VM Images from either https://www.linuxvmimages.com/ Or https://www.osboxes.org/virtualbox-images/

Installing MySQL in Ubuntu OS is very easy, you just need to follow 3 steps.

Update, Install MySQL CE Server and Configure.

Step 1:

Make sure to get all the updated Package Information before Installing MySQL.

root@osboxes:~# apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [83.3 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2,786 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [1,558 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [297 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [301 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:10 http://us.archive.ubuntu.com/ubuntu bionic-backports/main amd64 DEP-11 Metadata [8,132 B]
Get:11 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [10.0 kB]
Get:12 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [55.2 kB]
Get:13 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [61.0 kB]
Get:14 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Fetched 5,343 kB in 1min 22s (64.9 kB/s)


Reading package lists... Done
Building dependency tree
Reading state information... Done
259 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@osboxes:~#
root@osboxes:~#

Step 2:

Install MySQL Server by running apt install mysql-server

root@osboxes:~# apt install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libaio1 libevent-core-2.1-6 libhtml-template-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
  libipc-sharedcache-perl mailx tinyca
The following NEW packages will be installed:
  libaio1 libevent-core-2.1-6 libhtml-template-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 9 newly installed, 0 to remove and 259 not upgraded.
Need to get 19.5 MB of archives.
After this operation, 155 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 mysql-common all 5.8+1.0.4 [7,308 B]
Get:2 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libaio1 amd64 0.3.110-5ubuntu0.1 [6,476 B]
Get:3 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mysql-client-core-5.7 amd64 5.7.40-0ubuntu0.18.04.1 [6,755 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mysql-client-5.7 amd64 5.7.40-0ubuntu0.18.04.1 [2,028 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mysql-server-core-5.7 amd64 5.7.40-0ubuntu0.18.04.1 [7,542 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libevent-core-2.1-6 amd64 2.1.8-stable-4build1 [85.9 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mysql-server-5.7 amd64 5.7.40-0ubuntu0.18.04.1 [3,006 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libhtml-template-perl all 2.97-1 [59.0 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mysql-server all 5.7.40-0ubuntu0.18.04.1 [9,944 B]
Selecting previously unselected package mysql-common.
(Reading database ... 132259 files and directories currently installed.)
Preparing to unpack .../0-mysql-common_5.8+1.0.4_all.deb ...
Unpacking mysql-common (5.8+1.0.4) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../1-libaio1_0.3.110-5ubuntu0.1_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-5ubuntu0.1) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../2-mysql-client-core-5.7_5.7.40-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.40-0ubuntu0.18.04.1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../3-mysql-client-5.7_5.7.40-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.40-0ubuntu0.18.04.1) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../4-mysql-server-core-5.7_5.7.40-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.40-0ubuntu0.18.04.1) ...
Selecting previously unselected package libevent-core-2.1-6:amd64.
Preparing to unpack .../5-libevent-core-2.1-6_2.1.8-stable-4build1_amd64.deb ...
Unpacking libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ...
Setting up mysql-common (5.8+1.0.4) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 132427 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.40-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.40-0ubuntu0.18.04.1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.97-1_all.deb ...
Unpacking libhtml-template-perl (2.97-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.40-0ubuntu0.18.04.1_all.deb ...
Unpacking mysql-server (5.7.40-0ubuntu0.18.04.1) ...
Setting up libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ...
Setting up libhtml-template-perl (2.97-1) ...
Setting up libaio1:amd64 (0.3.110-5ubuntu0.1) ...
Setting up mysql-client-core-5.7 (5.7.40-0ubuntu0.18.04.1) ...
Setting up mysql-server-core-5.7 (5.7.40-0ubuntu0.18.04.1) ...
Setting up mysql-client-5.7 (5.7.40-0ubuntu0.18.04.1) ...
Setting up mysql-server-5.7 (5.7.40-0ubuntu0.18.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Setting up mysql-server (5.7.40-0ubuntu0.18.04.1) ...#####################################################################################################################################################################...............]
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...##############################################################################################################################################################################.....]
Processing triggers for systemd (237-3ubuntu10.52) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...

Check the MySQL Service Status using systemctl status/start/enable

root@osboxes:~#  systemctl start mysql.service
root@osboxes:~#  systemctl status mysql.service
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2022-10-30 09:25:22 EDT; 4min 28s ago
 Main PID: 3072 (mysqld)
    Tasks: 27 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─3072 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid

Oct 30 09:25:20 osboxes systemd[1]: Starting MySQL Community Server...
Oct 30 09:25:22 osboxes systemd[1]: Started MySQL Community Server.
root@osboxes:~#  systemctl enable mysql.service
Synchronizing state of mysql.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mysql

Step 3:

mysql_secure_installation — Improve MySQL Installation Security

This program enables you to improve the security of your MySQL installation in the following ways:

  • You can set a password for root accounts.
  • You can remove root accounts that are accessible from outside the local host.
  • You can remove anonymous-user accounts.
  • You can remove the test database (which by default can be accessed by all users, even anonymous users), and privileges that permit anyone to access databases with names that start with test_.

root@osboxes:~# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.

New password:

Re-enter new password:

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

This step Completes the Installation Part. You can now login and verify.

root@osboxes:~# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.40-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version();
+-------------------------+
| version()               |
+-------------------------+
| 5.7.40-0ubuntu0.18.04.1 |
+-------------------------+
1 row in set (0.00 sec)

mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+-------------------------+
| Variable_name           | Value                   |
+-------------------------+-------------------------+
| innodb_version          | 5.7.40                  |
| protocol_version        | 10                      |
| slave_type_conversions  |                         |
| tls_version             | TLSv1,TLSv1.1,TLSv1.2   |
| version                 | 5.7.40-0ubuntu0.18.04.1 |
| version_comment         | (Ubuntu)                |
| version_compile_machine | x86_64                  |
| version_compile_os      | Linux                   |
+-------------------------+-------------------------+
8 rows in set (0.01 sec)

mysql> create database sriram;
Query OK, 1 row affected (0.00 sec)

mysql> use sriram;
Database changed
mysql> create table sriram_table (id int, name varchar(200));
Query OK, 0 rows affected (3.82 sec)

mysql> insert into sriram_table values(1,'Sriram');
Query OK, 1 row affected (0.41 sec)

mysql>  insert into sriram_table values(2,'Sriram2');
Query OK, 1 row affected (0.11 sec)

mysql>  insert into sriram_table values(3,'Sriram3');
Query OK, 1 row affected (0.41 sec)

mysql> commit;
Query OK, 0 rows affected (0.11 sec)

mysql> select * from sriram_table;
+------+---------+
| id   | name    |
+------+---------+
|    1 | Sriram  |
|    2 | Sriram2 |
|    3 | Sriram3 |
+------+---------+
3 rows in set (0.11 sec)

mysql> exit
Bye

Upgrade Paths

  • Upgrade from MySQL 5.7 to 8.0 is supported. However, upgrade is only supported between General Availability (GA) releases. For MySQL 8.0, it is required that you upgrade from a MySQL 5.7 GA release (5.7.9 or higher). Upgrades from non-GA releases of MySQL 5.7 are not supported.
  • Upgrading to the latest release is recommended before upgrading to the next version. For example, upgrade to the latest MySQL 5.7 release before upgrading to MySQL 8.0.
  • Upgrade that skips versions is not supported. For example, upgrading directly from MySQL 5.6 to 8.0 is not supported.
  • Once a release series reaches General Availability (GA) status, upgrade within the release series (from one GA version to another GA version) is supported. For example, upgrading from MySQL 8.0.x to 8.0.y is supported. (Upgrade involving development-status non-GA releases is not supported.) Skipping a release is also supported. For example, upgrading from MySQL 8.0.x to 8.0.z is supported. MySQL 8.0.11 is the first GA status release within the MySQL 8.0 release series.

Run update and upgrade to get the latest Package information and also all the Other Packages to be updated. This Step Takes a while.

root@osboxes:~# apt-get update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [83.3 kB]
Get:5 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [55.2 kB]
Get:6 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [61.0 kB]
Get:7 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:8 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [297 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [302 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:11 http://us.archive.ubuntu.com/ubuntu bionic-backports/main amd64 DEP-11 Metadata [8,076 B]
Get:12 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [10.0 kB]
Fetched 999 kB in 40s (24.8 kB/s)
Reading package lists... Done
root@osboxes:~# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  linux-generic-hwe-18.04 linux-headers-generic-hwe-18.04 linux-image-generic-hwe-18.04
The following packages will be upgraded:
  apport apport-gtk bash bind9-host binutils binutils-common binutils-x86-64-linux-gnu bluez bluez-cups bluez-obexd busybox-initramfs busybox-static ca-certificates command-not-found command-not-found-data cron cups cups-bsd
  cups-client cups-common cups-core-drivers cups-daemon cups-ipp-utils cups-ppdc cups-server-common dbus dbus-user-session dbus-x11 deja-dup dirmngr distro-info-data dnsmasq-base dnsutils dpkg e2fsprogs firefox firefox-locale-en
  fonts-opensymbol ghostscript ghostscript-x gir1.2-javascriptcoregtk-4.0 gir1.2-notify-0.7 gir1.2-polkit-1.0 gir1.2-webkit2-4.0 gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm gpgv
  gstreamer1.0-gtk3 gstreamer1.0-plugins-good gstreamer1.0-pulseaudio gzip imagemagick imagemagick-6-common imagemagick-6.q16 intel-microcode isc-dhcp-client isc-dhcp-common klibc-utils libasn1-8-heimdal libbind9-160 libbinutils
  libbluetooth3 libc-bin libc6 libc6-dbg libcaca0 libcom-err2 libcups2 libcupscgi1 libcupsimage2 libcupsmime1 libcupsppdc1 libcurl3-gnutls libdbus-1-3 libdns-export1100 libdns1100 libdpkg-perl libevdev2 libexempi3 libexpat1 libext2fs2
  libfreerdp-client2-2 libfreerdp2-2 libfreetype6 libfribidi0 libgcrypt20 libglib2.0-0 libglib2.0-bin libglib2.0-data libgmp10 libgnutls30 libgs9 libgs9-common libgssapi3-heimdal libgstreamer-plugins-good1.0-0 libhcrypto4-heimdal
  libheimbase1-heimdal libheimntlm0-heimdal libhttp-daemon-perl libhx509-5-heimdal libicu60 libinput-bin libinput10 libirs160 libisc-export169 libisc169 libisccc160 libisccfg160 libjavascriptcoregtk-4.0-18 libjpeg-turbo8 libkeyutils1
  libklibc libkrb5-26-heimdal libksba8 libldap-2.4-2 libldap-common liblouis-data liblouis14 liblwres160 liblzma5 libmagickcore-6.q16-3 libmagickcore-6.q16-3-extra libmagickwand-6.q16-3 libnetplan0 libnotify-bin libnotify4
  libnss-myhostname libnss-systemd libnss3 libntfs-3g88 libopenexr22 libpam-systemd libpcre3 libperl5.26 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libpoppler-glib8 libpoppler73 libpython2.7 libpython2.7-minimal
  libpython2.7-stdlib libpython3.6 libpython3.6-minimal libpython3.6-stdlib libreoffice-avmedia-backend-gstreamer libreoffice-base-core libreoffice-calc libreoffice-common libreoffice-core libreoffice-draw libreoffice-gnome
  libreoffice-gtk3 libreoffice-impress libreoffice-math libreoffice-ogltrans libreoffice-pdfimport libreoffice-style-breeze libreoffice-style-galaxy libreoffice-style-tango libreoffice-writer libroken18-heimdal libsasl2-2
  libsasl2-modules libsasl2-modules-db libseccomp2 libsensors4 libsepol1 libsmbclient libsnmp-base libsnmp30 libspeex1 libspeexdsp1 libsqlite3-0 libss2 libssl1.0.0 libssl1.1 libsystemd0 libtiff5 libudev1 libwayland-client0
  libwayland-cursor0 libwayland-egl1 libwayland-server0 libwbclient0 libwebkit2gtk-4.0-37 libwind0-heimdal libwinpr2-2 libxml2 libxslt1.1 linux-base linux-firmware locales login multiarch-support netplan.io networkd-dispatcher nplan
  ntfs-3g open-vm-tools open-vm-tools-desktop openssl passwd perl perl-base perl-modules-5.26 policykit-1 poppler-utils python3-apport python3-commandnotfound python3-louis python3-mako python3-pil python3-problem-report
  python3-software-properties python3-uno python3.6 python3.6-minimal rsync rsyslog samba-libs sbsigntool snapd software-properties-common software-properties-gtk systemd systemd-sysv tar tcpdump thunderbird thunderbird-gnome-support
  thunderbird-locale-en thunderbird-locale-en-us tzdata ubuntu-advantage-tools udev ufw uno-libs3 unzip ure wireless-regdb xserver-common xserver-xephyr xserver-xorg-core-hwe-18.04 xserver-xorg-legacy-hwe-18.04 xwayland xxd xz-utils
  zlib1g
256 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
225 standard security updates
Need to get 439 MB of archives.
After this operation, 101 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

...................
....................
....................
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
root@osboxes:~#

Download the latest MySQL APT Repository from https://dev.mysql.com/downloads/repo/apt/

root@osboxes:~# wget https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb
--2022-10-30 12:52:21--  https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb
Resolving dev.mysql.com (dev.mysql.com)... 2600:140f:400:19a::2e31, 2600:140f:400:1b2::2e31, 23.214.233.36
Connecting to dev.mysql.com (dev.mysql.com)|2600:140f:400:19a::2e31|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://repo.mysql.com//mysql-apt-config_0.8.24-1_all.deb [following]
--2022-10-30 12:52:22--  https://repo.mysql.com//mysql-apt-config_0.8.24-1_all.deb
Resolving repo.mysql.com (repo.mysql.com)... 49.44.146.86
Connecting to repo.mysql.com (repo.mysql.com)|49.44.146.86|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18048 (18K) [application/x-debian-package]
Saving to: ‘mysql-apt-config_0.8.24-1_all.deb’

mysql-apt-config_0.8.24-1_all.deb                           100%[========================================================================================================================================>]  17.62K  --.-KB/s    in 0s

2022-10-30 12:52:25 (101 MB/s) - ‘mysql-apt-config_0.8.24-1_all.deb’ saved [18048/18048]

Now Install the Downloaded APT Repo and update .

root@osboxes:~# dpkg -i mysql-apt-config_0.8.24-1_all.deb
Selecting previously unselected package mysql-apt-config.
(Reading database ... 132603 files and directories currently installed.)
Preparing to unpack mysql-apt-config_0.8.24-1_all.deb ...
Unpacking mysql-apt-config (0.8.24-1) ...
Setting up mysql-apt-config (0.8.24-1) ...
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)
OK
root@osboxes:~# apt-get update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 http://repo.mysql.com/apt/ubuntu bionic InRelease [20.0 kB]
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [83.3 kB]
Get:6 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 Sources [973 B]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-apt-config i386 Packages [567 B]
Get:8 http://repo.mysql.com/apt/ubuntu bionic/mysql-apt-config amd64 Packages [567 B]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 i386 Packages [8,533 B]
Get:10 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 Packages [8,528 B]
Get:11 http://repo.mysql.com/apt/ubuntu bionic/mysql-tools amd64 Packages [8,196 B]
Get:12 http://repo.mysql.com/apt/ubuntu bionic/mysql-tools i386 Packages [8,200 B]
Get:13 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [55.2 kB]
Get:14 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [61.1 kB]
Get:15 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:16 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2,803 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [1,558 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [296 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [302 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:21 http://us.archive.ubuntu.com/ubuntu bionic-backports/main amd64 DEP-11 Metadata [8,132 B]
Get:22 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [10.0 kB]
Fetched 5,415 kB in 1min 9s (78.5 kB/s)
Reading package lists... Done

Run apt-get install mysql-server to Install the Latest Version

root@osboxes:~# apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libevent-core-2.1-6
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins mysql-community-server mysql-community-server-core
The following packages will be REMOVED:
  mysql-client-5.7 mysql-client-core-5.7 mysql-server-5.7 mysql-server-core-5.7
The following NEW packages will be installed:
  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-community-client mysql-community-client-core mysql-community-client-plugins mysql-community-server mysql-community-server-core
The following packages will be upgraded:
  mysql-common mysql-server
2 upgraded, 10 newly installed, 4 to remove and 3 not upgraded.
Need to get 48.3 MB of archives.
After this operation, 202 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-server amd64 8.0.31-1ubuntu18.04 [68.3 kB]
Get:2 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-common amd64 8.0.31-1ubuntu18.04 [72.4 kB]
Get:3 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client-plugins amd64 8.0.31-1ubuntu18.04 [1,268 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 libmecab2 amd64 0.996-5 [257 kB]
Get:5 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client-core amd64 8.0.31-1ubuntu18.04 [1,938 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 mecab-utils amd64 0.996-5 [4,856 B]
Get:7 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 mecab-ipadic all 2.7.0-20070801+main-1 [12.1 MB]
Get:8 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.31-1ubuntu18.04 [3,564 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 mecab-ipadic-utf8 all 2.7.0-20070801+main-1 [3,522 B]
Get:10 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-client amd64 8.0.31-1ubuntu18.04 [68.3 kB]
Get:11 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.31-1ubuntu18.04 [28.8 MB]
Get:12 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server amd64 8.0.31-1ubuntu18.04 [79.5 kB]
Fetched 48.3 MB in 1min 8s (713 kB/s)
Preconfiguring packages ...
(Reading database ... 132608 files and directories currently installed.)
Preparing to unpack .../mysql-server_8.0.31-1ubuntu18.04_amd64.deb ...
Unpacking mysql-server (8.0.31-1ubuntu18.04) over (5.7.40-0ubuntu0.18.04.1) ...
(Reading database ... 132609 files and directories currently installed.)
Removing mysql-server-5.7 (5.7.40-0ubuntu0.18.04.1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Removing mysql-client-5.7 (5.7.40-0ubuntu0.18.04.1) ...
Removing mysql-client-core-5.7 (5.7.40-0ubuntu0.18.04.1) ...
Removing mysql-server-core-5.7 (5.7.40-0ubuntu0.18.04.1) ...
(Reading database ... 132395 files and directories currently installed.)
Preparing to unpack .../00-mysql-common_8.0.31-1ubuntu18.04_amd64.deb ...
Unpacking mysql-common (8.0.31-1ubuntu18.04) over (5.8+1.0.4) ...
Selecting previously unselected package mysql-community-client-plugins.
Preparing to unpack .../01-mysql-community-client-plugins_8.0.31-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client-plugins (8.0.31-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-client-core.
Preparing to unpack .../02-mysql-community-client-core_8.0.31-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client-core (8.0.31-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-client.
Preparing to unpack .../03-mysql-community-client_8.0.31-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client (8.0.31-1ubuntu18.04) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../04-mysql-client_8.0.31-1ubuntu18.04_amd64.deb ...
Unpacking mysql-client (8.0.31-1ubuntu18.04) ...
Selecting previously unselected package libmecab2:amd64.
Preparing to unpack .../05-libmecab2_0.996-5_amd64.deb ...
Unpacking libmecab2:amd64 (0.996-5) ...
Selecting previously unselected package mysql-community-server-core.
Preparing to unpack .../06-mysql-community-server-core_8.0.31-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-server-core (8.0.31-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack .../07-mysql-community-server_8.0.31-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-server (8.0.31-1ubuntu18.04) ...
Selecting previously unselected package mecab-utils.
Preparing to unpack .../08-mecab-utils_0.996-5_amd64.deb ...
Unpacking mecab-utils (0.996-5) ...
Selecting previously unselected package mecab-ipadic.
Preparing to unpack .../09-mecab-ipadic_2.7.0-20070801+main-1_all.deb ...
Unpacking mecab-ipadic (2.7.0-20070801+main-1) ...
Selecting previously unselected package mecab-ipadic-utf8.
Preparing to unpack .../10-mecab-ipadic-utf8_2.7.0-20070801+main-1_all.deb ...
Unpacking mecab-ipadic-utf8 (2.7.0-20070801+main-1) ...
Setting up mysql-common (8.0.31-1ubuntu18.04) ...
Installing new version of config file /etc/mysql/conf.d/mysql.cnf ...
Installing new version of config file /etc/mysql/my.cnf.fallback ...
Setting up libmecab2:amd64 (0.996-5) ...
Setting up mysql-community-client-plugins (8.0.31-1ubuntu18.04) ...
Setting up mysql-community-server-core (8.0.31-1ubuntu18.04) ...
Setting up mecab-utils (0.996-5) ...
Setting up mecab-ipadic (2.7.0-20070801+main-1) ...
Compiling IPA dictionary for Mecab.  This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27327
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix      : 100% |###########################################|

done!
update-alternatives: using /var/lib/mecab/dic/ipadic to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-community-client-core (8.0.31-1ubuntu18.04) ...
Setting up mecab-ipadic-utf8 (2.7.0-20070801+main-1) ...
Compiling IPA dictionary for Mecab.  This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27327
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix      : 100% |###########################################|

done!
update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-community-client (8.0.31-1ubuntu18.04) ...
Setting up mysql-client (8.0.31-1ubuntu18.04) ...
Setting up mysql-community-server (8.0.31-1ubuntu18.04) ...
Installing new version of config file /etc/apparmor.d/usr.sbin.mysqld ...
Installing new version of config file /etc/mysql/mysql.cnf ...
Installing new version of config file /etc/mysql/mysql.conf.d/mysqld.cnf ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up mysql-server (8.0.31-1ubuntu18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.6) ...

With the Above, the Actual Upgrade has been completed and you can now verify the Version Number and your data compatibilities as below.

root@osboxes:~# mysql -v
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.31 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Reading history-file /root/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Writing history-file /root/.mysql_history
Bye
root@osboxes:~# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.31 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sriram             |
| sys                |
+--------------------+
5 rows in set (0.01 sec)

mysql> use sriram;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+------------------+
| Tables_in_sriram |
+------------------+
| sriram_table     |
+------------------+
1 row in set (0.00 sec)

mysql> select * from sriram_table;
+------+---------+
| id   | name    |
+------+---------+
|    1 | Sriram  |
|    2 | Sriram2 |
|    3 | Sriram3 |
+------+---------+
3 rows in set (0.00 sec)

mysql> exit
Bye

you can also use mysqlcheck for the Incompatibilities, (The mysql_upgrade is now deprecated with this version)

root@osboxes:~# mysqlcheck --user=root -p --all-databases
Enter password:
mysql.columns_priv                                 OK
mysql.component                                    OK
mysql.db                                           OK
mysql.default_roles                                OK
mysql.engine_cost                                  OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.global_grants                                OK
mysql.gtid_executed                                OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.ndb_binlog_index                             OK
mysql.password_history                             OK
mysql.plugin                                       OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.replication_asynchronous_connection_failover OK
mysql.replication_asynchronous_connection_failover_managed OK
mysql.replication_group_configuration_version      OK
mysql.replication_group_member_actions             OK
mysql.role_edges                                   OK
mysql.server_cost                                  OK
mysql.servers                                      OK
mysql.slave_master_info                            OK
mysql.slave_relay_log_info                         OK
mysql.slave_worker_info                            OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
sriram.sriram_table                                OK
sys.sys_config                                     OK






root@osboxes:~# mysqlcheck --user=root -p --all-databases --check-upgrade
Enter password:
mysql.columns_priv                                 Table is already up to date
mysql.component                                    Table is already up to date
mysql.db                                           Table is already up to date
mysql.default_roles                                Table is already up to date
mysql.engine_cost                                  Table is already up to date
mysql.func                                         Table is already up to date
mysql.general_log                                  Table is already up to date
mysql.global_grants                                Table is already up to date
mysql.gtid_executed                                Table is already up to date
mysql.help_category                                Table is already up to date
mysql.help_keyword                                 Table is already up to date
mysql.help_relation                                Table is already up to date
mysql.help_topic                                   Table is already up to date
mysql.innodb_index_stats                           Table is already up to date
mysql.innodb_table_stats                           Table is already up to date
mysql.ndb_binlog_index                             Table is already up to date
mysql.password_history                             Table is already up to date
mysql.plugin                                       Table is already up to date
mysql.procs_priv                                   Table is already up to date
mysql.proxies_priv                                 Table is already up to date
mysql.replication_asynchronous_connection_failover Table is already up to date
mysql.replication_asynchronous_connection_failover_managed Table is already up to date
mysql.replication_group_configuration_version      Table is already up to date
mysql.replication_group_member_actions             Table is already up to date
mysql.role_edges                                   Table is already up to date
mysql.server_cost                                  Table is already up to date
mysql.servers                                      Table is already up to date
mysql.slave_master_info                            Table is already up to date
mysql.slave_relay_log_info                         Table is already up to date
mysql.slave_worker_info                            Table is already up to date
mysql.slow_log                                     Table is already up to date
mysql.tables_priv                                  Table is already up to date
mysql.time_zone                                    Table is already up to date
mysql.time_zone_leap_second                        Table is already up to date
mysql.time_zone_name                               Table is already up to date
mysql.time_zone_transition                         Table is already up to date
mysql.time_zone_transition_type                    Table is already up to date
mysql.user                                         Table is already up to date
sriram.sriram_table                                Table is already up to date
sys.sys_config                                     Table is already up to date
root@osboxes:~#

Hope this is helpful. Have a good day.

-Sriram Sanka

Reference Links

https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#apt-repo-fresh-install

https://dev.mysql.com/downloads/repo/apt/

https://dev.mysql.com/doc/refman/5.7/en/updating-apt-repo.html

https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-utilities-upgrade.html

https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#repo-qg-apt-upgrading

https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#repo-qg-apt-repo-manual-setup

https://dev.mysql.com/doc/refman/8.0/en/upgrading.html

https://dev.mysql.com/doc/refman/8.0/en/upgrade-before-you-begin.html

https://dev.mysql.com/doc/refman/8.0/en/upgrading-what-is-upgraded.html

https://dev.mysql.com/doc/refman/8.0/en/upgrade-prerequisites.html

Posted in Installation, Linux, MySql, oracle, Ubuntu, Upgrade 5.7 to 8, VM Images | Tagged: , , , , , , | Leave a Comment »

 
Tales From A Lazy Fat DBA

Its all about Databases & their performance, troubleshooting & much more .... ¯\_(ツ)_/¯

Thinking Out Loud

Michael T. Dinh, Oracle DBA

Notes On Oracle

by Mehmet Eser

Oracle Diagnostician

Performance troubleshooting as exact science

deveshdba

get sum oracle stuffs

Data Warehousing with Oracle

Dani Schnider's Blog

ORASteps

Oracle DBA's Daily Work

DBAspaceblog.com

Welcome everyone!! The idea of this blog is to help the DBA in their daily tasks. Enjoy.

Anand's Data Stories

Learn. Share. Repeat.

Tanel Poder's blog: Core IT for geeks and pros

Oracle Performance Tuning, Troubleshooting, Internals

Yet Another OCM

Journey as an Oracle Certified Master

DBAtricksWorld.com

Sharing Knowledge is ultimate key to Gaining knowledge...

Neil Chandler's DB Blog

A resource for Database Professionals

DBA Kevlar

Tips, tricks, (and maybe a few rants) so more DBA's become bulletproof!

OraExpert Academy

Consulting and Training