banner



How To Install Mysql Server And Client In Ubuntu

MySQL is well known and an open up-source database management system. It uses a relational database and SQL to manage data. It is easy to use, fast, and integrated with pop stacks Lamp, Xampp, Lemp, etc.

In this tutorial, I volition cover how to install MySQL in Ubuntu xx.04, Secure MySQL, Cheque MySQL service, Connect and apply MySQL server, Uninstall MySQL in Ubuntu and more.

I have created a video tutorial in Hindi on how to install MySQL in the Hindi linguistic communication. If you are good in Hindi and then watch the following video

Before starting to install MySQL in Ubuntu you must have access of system with root user or sudo user.

Commodity Contents

  • How to install MySQL in Ubuntu from its Repositories
  • Install MySQL in Ubuntu from Official Repositories
  • Check MySQL installation & Service
  • Secure MySQL by i control
  • Connect to MySQL Server
  • Uninstall MySQL in Ubuntu
  • Conclusion

Command Tabular array How to install MySQL in Ubuntu

Command Description
sudo apt-get update Update Repository
sudo apt-get install mysql-server Install MySQL server on Ubuntu
mysql –version Check MySQL version afterwards installation
sudo systemctl status mysql.service Check the Status of MySQL service
sudo systemctl commencement mysql.service Start MySQL service
sudo systemctl stop mysql.service Stop MySQL service
sudo mysql_secure_installation Kickoff mysql secure installation on Ubuntu
sudo mysql -h localhost -u root -p Connect to mysql on localhost

How to install MySQL in Ubuntu from its Repositories

I tin can't clinch you that you will find the latest version of MySQL on Ubuntu repositories. If you will install MySQL by using ubuntu repository, you will find only the version available on ubuntu repository.

Run the following command to update repository list with update packages.

                      [email protected]          :            ~/Desktop          $ sudo apt-become update [sudo] countersign for vijay:  Striking:one http://in.archive.ubuntu.com/ubuntu focal InRelease Go:2 http://in.annal.ubuntu.com/ubuntu focal-updates InRelease [106 kB] Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]      Hit:4 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease  Go:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [xiii.4 kB] Get:6 http://in.annal.ubuntu.com/ubuntu focal-updates/main amd64 Packages [35.v kB] Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main Translation-en [15.0 kB] Get:8 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [14.6 kB] Go:9 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 c-north-f Metadata [1,232 B] Get:10 http://in.archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages [10.5 kB] Become:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [12.3 kB] Get:12 http://in.archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [v,676 B] Get:xiii http://in.annal.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [212 B] Get:14 http://in.annal.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [788 B] Get:15 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages [12.7 kB] Get:16 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [29.5 kB] Get:17 http://security.ubuntu.com/ubuntu focal-security/principal Translation-en [12.2 kB] Get:18 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-xi Metadata [14.six kB] Get:19 http://security.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [928 B] Become:xx http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [3,576 B] Go:21 http://security.ubuntu.com/ubuntu focal-security/universe i386 Packages [3,112 B] Become:22 http://security.ubuntu.com/ubuntu focal-security/universe Translation-en [three,328 B] Get:23 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [208 B] Get:24 http://security.ubuntu.com/ubuntu focal-security/universe amd64 c-northward-f Metadata [492 B] Fetched 403 kB in 5s (76.9 kB/s)   Reading package lists... Done                      [email protected]          :            ~/Desktop          $        

Use the following command to starting time installation.

                      [email protected]                    :                      ~                    $sudo apt-get install mysql-server Reading package lists... Done Building dependency tree        Reading land information... Done The post-obit additional packages will exist installed:   libaio1 libcgi-fast-perl libcgi-pm-perl libevent-core-2.1-7 libfcgi-perl libhtml-template-perl libmecab2 mecab-ipadic mecab-ipadic-utf8   mecab-utils mysql-client-viii.0 mysql-client-core-8.0 mysql-server-viii.0 mysql-server-cadre-eight.0 Suggested packages:   libipc-sharedcache-perl mailx tinyca The following NEW packages will exist installed:   libaio1 libcgi-fast-perl libcgi-pm-perl libevent-core-two.1-7 libfcgi-perl libhtml-template-perl libmecab2 mecab-ipadic mecab-ipadic-utf8   mecab-utils mysql-client-8.0 mysql-client-cadre-8.0 mysql-server mysql-server-viii.0 mysql-server-core-8.0 0 upgraded, 15 newly installed, 0 to remove and 32 not upgraded. Need to get 29.8 MB of archives. Afterwards this operation, 245 MB of additional disk space will be used. Do you want to go along? [Y/northward]                  

Press Y to proceed process.

Install MySQL in Ubuntu from Official Repositories

In the previous, section I take installed MySQL from ubuntu repository, so I see the installed version past running following command.

                      [e-mail protected]                    :                      ~                    $mysql --version mysql  Ver 8.0.xix-0ubuntu5 for Linux on x86_64 ((Ubuntu))                      [email protected]                    :                      ~                    $        

I found installed MySQL version is 8.0.xix. Then I visited official website Here and I found the latest version of MySQL is 8.xiii-1.

Now I desire to install newer version. Y'all can do the aforementioned Become to Download page and click on download then copy the link from hyperlink text is "No thank you, just showtime my download"

                      [electronic mail protected]                    :                      ~                    $wget https://dev.mysql.com/get/mysql-apt-config_0.8.xiii-1_all.deb --2020-05-01 18:24:10--  https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11 Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... continued. HTTP request sent, awaiting response... 302 Found Location: https://repo.mysql.com//mysql-apt-config_0.8.13-1_all.deb [following] --2020-05-01 18:24:14--  https://repo.mysql.com//mysql-apt-config_0.8.xiii-1_all.deb Resolving repo.mysql.com (repo.mysql.com)... 23.62.138.106 Connecting to repo.mysql.com (repo.mysql.com)|23.62.138.106|:443... connected. HTTP asking sent, pending response... 200 OK Length: 35560 (35K) [application/10-debian-packet] Saving to: 'mysql-apt-config_0.eight.13-1_all.deb'  mysql-apt-config_0.8.thirteen-1_all.deb   100%[=================================================================>]  34.73K  --.-KB/s    in 0.1s      2022-05-01 18:24:fifteen (243 KB/s) - 'mysql-apt-config_0.viii.xiii-1_all.deb' saved [35560/35560]                      [email protected]                    :                      ~                    $        

Next stride to configure repository by running following command

$sudo dpkg -i mysql-apt-config*

                      [e-mail protected]                    :                      ~                    $udo dpkg -i mysql-apt-config_0.8.13-1_all.deb  (Reading database ... 172110 files and directories currently installed.) Preparing to unpack mysql-apt-config_0.eight.13-1_all.deb ... Unpacking mysql-apt-config (0.8.13-1) over (0.8.13-i) ... Setting upward mysql-apt-config (0.8.13-ane) ... Alarm: apt-central should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config) OK                      [email protected]                    :                      ~                    $        
15-configure-apt
14-select-mysql-versioin
16-select-appropriate-mysql-version

Again update repository and install mysql-server by running same command every bit above.

$sudo apt-go update
$sudo apt-get install mysql-server

Ane windows will be prompt to select password strong and encryption then press ok.

17-use-strong-password
                      [email protected]                    :                      ~                    $mysql --version mysql  Ver 8.0.16 for Linux on x86_64 (MySQL Community Server - GPL)                      [e-mail protected]                    :                      ~                    $        

Check MySQL installation & Service

In one case the install process volition be complete, You lot tin check the status of mysql service.

The following control volition help:

                      [e-mail protected]                    :                      ~                    $sudo systemctl status mysql.service ● mysql.service - MySQL Community Server    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)    Agile: active (running) since Fri 2022-06-21 08:59:45 IST; 6min agone      Docs: man:mysqld(eight)            http://dev.mysql.com/medico/refman/en/using-systemd.html  Master PID: 8127 (mysqld)    Status: "SERVER_OPERATING"     Tasks: 37 (limit: 2331)    Memory: 544.1M    CGroup: /arrangement.slice/mysql.service            └─8127 /usr/sbin/mysqld  Jun 21 08:59:20 Ubuntu-19 systemd[1]: Starting MySQL Community Server... Jun 21 08:59:45 Ubuntu-19 systemd[1]: Started MySQL Community Server.                      [email protected]                    :                      ~                    $        

Secure MySQL past one command

Securing DBMS is very of import for Database Administrator, You can secure MySQL in one command just like a charm.

Command has been given below.

                      [email protected]                    :                      ~                    $sudo mysql_secure_installation        

When the secure installation script volition run lots of option volition display on the screen give the respond one by 1 wisely.

In the middle of this process, you can set the stiff password for the mysql root user. The MySQL root user is different from the system root user.

  • Printing y|Y for Yes, any other central for No: Y
  • Please enter 0 = LOW, i = MEDIUM and ii = Potent: 1
  • Please set up the password for root hither.
    New password:
    Re-enter new password:
  • Remove anonymous users? (Printing y|Y for Yep, any other key for No) : y
  • Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
  • Remove test database and access to it? (Press y|Y for Yep, any other key for No) : Y
  • Reload privilege tables now? (Printing y|Y for Yes, any other key for No) : Y

Connect to MySQL Server

I am going to connect using root user and countersign on localhost automobile.

                      [email protected]                    :                      ~                    $sudo mysql -h localhost -u root -p Enter password:  Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connectedness id is 17 Server version: 8.0.16 MySQL Customs Server - GPL  Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.  Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may exist trademarks of their respective owners.  Type 'help;' or '\h' for assist. Type '\c' to clear the current input statement.  mysql> go out Adieu                      [e-mail protected]                    :                      ~                    $        

Uninstall MySQL in Ubuntu

This is very important section for the new user, In this department I volition cover how to uninstall MySQL in Ubuntu. As you lot have seen, I have installed the latest MySQL 8.0 in the previous section.

First you lot need to stop and disable mysql service, And then run the post-obit command:

                      [email protected]                    :                      ~                    $sudo systemctl finish mysql.service  [sudo] countersign for vijay:                                [email protected]                    :                      ~                    $        
                      [email protected]                    :                      ~                    $sudo systemctl disable mysql.service  Synchronizing state of mysql.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install disable mysql Removed /etc/systemd/organization/multi-user.target.wants/mysql.service.                      [email protected]                    :                      ~                    $        

If y'all have installed from ubuntu repository then run the following command to uninstall Ubuntu.

$sudo apt-get purge mysql*

If you have installed from official repository, then you must follow the given instruction advisedly.

Write command $sudo apt-get purge mysql- and printing TAB key two times from your keyboard. yous will see all available option. See in the case:

                      [email protected]                    :                      ~                    $sudo apt-get purge mysql- mysql-apt-config             mysql-common                 mysql-customs-customer-cadre  mysql-community-server-core mysql-client                 mysql-community-customer       mysql-community-server       mysql-server                      [electronic mail protected]                    :                      ~                    $        

Consummate your command with write all available options. See in Example and Hitting enter.

Command volition ask your confirmation, Printing "Y" and striking enter.

                      [electronic mail protected]                    :                      ~                    $sudo apt-get purge mysql-server mysql-client mysql-mutual mysql-customs-client-core mysql-apt-config mysql-community-server-core Reading packet lists... Done Edifice dependency tree        Reading state information... Done The following packages were automatically installed and are no longer required:   acl apg colord-data gnome-control-middle-faces gnome-online-accounts hplip-data libaio1 libcolord-gtk1 libcolorhug2 libevent-core-two.1-6   libgsound0 libgtop-2.0-11 libgtop2-common libieee1284-iii libimagequant0 libmecab2 libsane-common libsnmp-base of operations libwebpmux3 mecab-ipadic   mecab-ipadic-utf8 mecab-utils mobile-broadband-provider-info mysql-community-server-core network-managing director-gnome   printer-driver-postscript-hp python3-macaroonbakery python3-olefile python3-pexpect python3-pil python3-protobuf python3-ptyprocess   python3-renderpm python3-reportlab python3-reportlab-accel python3-rfc3339 python3-tz ubuntu-system-service Utilize 'sudo apt autoremove' to remove them. The following packages will exist REMOVED:   colord* gnome-control-center* hplip* libhpmud0* libmysqlclient20* libsane* libsane-hpaio* libsnmp30* mysql-client* mysql-common*   mysql-community-customer* mysql-community-client-core* mysql-customs-server* mysql-server* printer-driver-hpcups* sane-utils* simple-browse*   ubuntu-desktop* ubuntu-desktop-minimal* 0 upgraded, 0 newly installed, xix to remove and 108 non upgraded. Later on this operation, 275 MB disk space will be freed. Do y'all want to go on? [Y/n]                  
18-remove-data-directory

Adjacent control $sudo apt-get autoremove is used to remove all unused dependencies from your system.

                      [email protected]                    :                      ~                    $sudo apt-get autoremove  Reading parcel lists... Washed Edifice dependency tree        Reading country data... Done The following packages will exist REMOVED:   acl apg colord-data gnome-control-heart-faces gnome-online-accounts hplip-data libaio1 libcolord-gtk1 libcolorhug2 libevent-cadre-two.1-six   libgsound0 libgtop-two.0-xi libgtop2-common libieee1284-3 libimagequant0 libmecab2 libsane-common libsnmp-base libwebpmux3 mecab-ipadic   mecab-ipadic-utf8 mecab-utils mobile-broadband-provider-info network-managing director-gnome printer-driver-postscript-hp python3-macaroonbakery   python3-olefile python3-pexpect python3-pil python3-protobuf python3-ptyprocess python3-renderpm python3-reportlab python3-reportlab-accel   python3-rfc3339 python3-tz ubuntu-arrangement-service 0 upgraded, 0 newly installed, 37 to remove and 107 not upgraded. After this operation, 86.vi MB disk space will exist freed. Do you lot want to continue? [Y/due north]                  

Conclusion

Now, You can install the old version from Ubuntu nineteen.04 repository or you can install the latest version of MySQL from its official repository. You lot tin be hardening MySQL, afterward y'all have learned how to uninstall MySQL from Ubuntu xix.04.

If you accept any question related this commodity, write in comment box.

Thanks for Reading, Don't forget to share.

If you similar our content, please consider buying us a coffee.
Thank you for your support!

Source: https://www.cyberpratibha.com/how-to-install-mysql-in-ubuntu/

Posted by: phillipsmaideared.blogspot.com

Related Posts

0 Response to "How To Install Mysql Server And Client In Ubuntu"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel