{"id":3369,"date":"2019-06-21T15:32:44","date_gmt":"2019-06-21T12:32:44","guid":{"rendered":"https:\/\/kifarunix.com\/?p=3369"},"modified":"2019-06-21T22:07:58","modified_gmt":"2019-06-21T19:07:58","slug":"install-mysql-8-on-debian-9","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-mysql-8-on-debian-9\/","title":{"rendered":"Install MySQL 8 on Debian 9"},"content":{"rendered":"\n

This guide will demonstrate how to install MySQL 8 on Debian 9.<\/p>\n\n\n\n

Install MySQL 8 on Debian 9<\/h2>\n\n\n\n

To install MySQL 8 on Debian 9, we are going to use MySQL APT repository which provides deb<\/code> packages for installing and managing the MySQL server, client, and other components.<\/p>\n\n\n\n

Run System Update<\/h3>\n\n\n\n

Update your system packages.<\/p>\n\n\n\n

apt update\napt upgrade<\/code><\/pre>\n\n\n\n

Add MySQL APT Repository<\/h3>\n\n\n\n

MySQL APT repository is not available on the default Debian 9  system software repository list. Therefore, download the repo and install it as shown below;<\/p>\n\n\n\n

wget https:\/\/repo.mysql.com\/\/mysql-apt-config_0.8.13-1_all.deb<\/code><\/pre>\n\n\n\n
apt install .\/mysql-apt-config_0.8.13-1_all.deb<\/code><\/pre>\n\n\n\n

During the installation, you will be prompted to select MySQL product version to install. Leave the defaults and select Ok<\/strong> and press Enter to install the repo.<\/p>\n\n\n\n

\"install<\/a><\/figure>\n\n\n\n

Once the installation is done, you need to run system update to load package list.<\/p>\n\n\n\n

apt update<\/code><\/pre>\n\n\n\n

Install MySQL 8 on Debian 9<\/h3>\n\n\n\n

Now that you got MySQL APT repos in place, you can now install MySQL 8 by running the installation commands below;<\/p>\n\n\n\n

apt install mysql-server<\/code><\/pre>\n\n\n\n

During the installation, you will be prompted to set MySQL root password. Hence, set the password and re-enter it when prompted.<\/p>\n\n\n\n

\"Install<\/a><\/figure>\n\n\n\n

Next, set the authentication plugin. Select the recommended option and proceed.<\/p>\n\n\n\n

\"MySQL<\/a><\/figure>\n\n\n\n

Want to install MySQL 8 on FreeBSD 12? See the link below;<\/p>\n\n\n\n

Install MySQL 8 on FreeBSD 12<\/a><\/p>\n\n\n\n

Running MySQL 8<\/h3>\n\n\n\n

MySQL 8 should be running immediately after the installation. Check status by executing the command below;<\/p>\n\n\n\n

systemctl status mysql.service \n\u25cf mysql.service - MySQL Community Server\n   Loaded: loaded (\/lib\/systemd\/system\/mysql.service; enabled; vendor preset: enabled)\n   Active: active (running) since Fri 2019-06-21 07:58:25 EDT; 2min 30s ago\n     Docs: man:mysqld(8)\n           http:\/\/dev.mysql.com\/doc\/refman\/en\/using-systemd.html\n  Process: 2822 ExecStartPre=\/usr\/share\/mysql-8.0\/mysql-systemd-start pre (code=exited, status=0\/SUCCESS)\n Main PID: 2857 (mysqld)\n   Status: \"SERVER_OPERATING\"\n    Tasks: 37 (limit: 4915)\n   CGroup: \/system.slice\/mysql.service\n           \u2514\u25002857 \/usr\/sbin\/mysqld\n\nJun 21 07:58:24 debian9 systemd[1]: Starting MySQL Community Server...\nJun 21 07:58:25 debian9 systemd[1]: Started MySQL Community Server.<\/code><\/pre>\n\n\n\n

It is also set to run on system boot by default.<\/p>\n\n\n\n

systemctl is-enabled  mysql.service \nenabled<\/code><\/pre>\n\n\n\n

MySQL 8 initial Security<\/h3>\n\n\n\n

MySQL comes bundled with a security script called mysql_secure_installation<\/strong> that is used to improve MySQL installation security. The script can run with no options as shown below.<\/p>\n\n\n\n

mysql_secure_installation<\/code><\/pre>\n\n\n\n
Securing the MySQL server deployment.\n\nEnter password for user root: ENTER THE PASSWORD SET DURING THE INSTALLATION<\/code><\/pre>\n\n\n\n

Next, you are prompted whether to enable the validate password plugin that is used to enforce password complexity. Type Y and press Enter to enable or any other key to ignore.<\/p>\n\n\n\n

VALIDATE PASSWORD COMPONENT can be used to test passwords\nand improve security. It checks the strength of password\nand allows the users to set only those passwords which are\nsecure enough. Would you like to setup VALIDATE PASSWORD component?\n\nPress y|Y for Yes, any other key for No: Y<\/code><\/pre>\n\n\n\n

If you accept to enable the validate password plugin, you will be prompted to choose the level of complexity, with three levels provided. Choose the level and press ENTER to proceed.<\/p>\n\n\n\n

There are three levels of password validation policy:\n\nLOW    Length >= 8\nMEDIUM Length >= 8, numeric, mixed case, and special characters\nSTRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file\n\nPlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1<\/code><\/pre>\n\n\n\n

Next, you are prompted whether to reset or use existing root password.<\/p>\n\n\n\n

Using existing password for root.\n\nEstimated strength of the password: 100 \nChange the password for root ? ((Press y|Y for Yes, any other key for No) : ENTER to retain existing password<\/code><\/pre>\n\n\n\n

Once the next prompts, press Y and enter to remove anonymous users, disallow remote root login, remove test databases and reload privileges tables to apply the changes.<\/p>\n\n\n\n

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\n\nNormally, root should only be allowed to connect from\n'localhost'. This ensures that someone cannot guess at\nthe root password from the network.\n\nDisallow root login remotely? (Press y|Y for Yes, any other key for No) : y \nSuccess.\n\nBy default, MySQL comes with a database named 'test' that\nanyone can access. This is also intended only for testing,\nand should be removed before moving into a production\nenvironment.\n\n\nRemove test database and access to it? (Press y|Y for Yes, any other key for No) : y\n - Dropping test database...\nSuccess.\n\n - Removing privileges on test database...\nSuccess.\n\nReloading the privilege tables will ensure that all changes\nmade so far will take effect immediately.\n\nReload privilege tables now? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\nAll done!<\/code><\/pre>\n\n\n\n

MySQL 8 is now installed and running on Debian 9. You can check the version of MySQL as a way of verifying the installation. You can simply use mysqladmin to check the version instead of logging in running the select version query.<\/p>\n\n\n\n

mysqladmin -u root -p version\nEnter password: \nmysqladmin  Ver 8.0.16 for Linux on x86_64 (MySQL Community Server - GPL)\nCopyright (c) 2000, 2019, Oracle and\/or its affiliates. All rights reserved.\n\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nServer version\t\t8.0.16\nProtocol version\t10\nConnection\t\tLocalhost via UNIX socket\nUNIX socket\t\t\/var\/run\/mysqld\/mysqld.sock\nUptime:\t\t\t21 min 42 sec\n\nThreads: 2  Questions: 13  Slow queries: 0  Opens: 144  Flush tables: 3  Open tables: 48  Queries per second avg: 0.009<\/code><\/pre>\n\n\n\n

Well done. You have MySQL 8.0.16 running on your debian 9 server.<\/p>\n\n\n\n

You can as well check our other related guides by following the links below;<\/p>\n\n\n\n

Install MySQL 8 on Fedora 30\/Fedora 29<\/a><\/p>\n\n\n\n

Install LAMP Stack on Fedora 30<\/a><\/p>\n\n\n\n

How To Install LAMP (Linux, Apache, MySQL, PHP) Stack on Fedora 28\/29<\/a><\/p>\n\n\n\n

Install MariaDB 10.3 on CentOS 7<\/a><\/p>\n\n\n\n

Install MariaDB 10.3 on Fedora 30<\/a><\/p>\n\n\n\n

Install phpMyAdmin with Apache on Fedora 30<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

This guide will demonstrate how to install MySQL 8 on Debian 9. Install MySQL 8 on Debian 9 To install MySQL 8 on Debian 9,<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[299,121,929],"tags":[1000,287,135,999],"class_list":["post-3369","post","type-post","status-publish","format-standard","hentry","category-database","category-howtos","category-mysql","tag-database","tag-debian-9","tag-mysql","tag-mysql-8","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3369"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=3369"}],"version-history":[{"count":5,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3369\/revisions"}],"predecessor-version":[{"id":3391,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3369\/revisions\/3391"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=3369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=3369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=3369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}