MySQL is the most popular open-source database management system supporting transactional relational databases. MySQL runs in a server-client architecture, where a MySQL server manages persistent databases and provides SQL query interfaces, while MySQL clients query the MySQL server to access MySQL databases.
In this tutorial, I will describe how to install MySQL server and client on Linux, by using a given distro's default package manager.
Install MySQL Server in Linux
To install MySQL server in Ubuntu or Debian:
During installation, you will be asked to provide the initial root password of the MySQL server. Once installation is completed, MySQL server gets started immediately, and is set to start automatically upon boot.
To install and auto-start MySQL server on boot in CentOS or RHEL:
$ sudo chkconfig mysqld on
To install and auto-start MySQL server on boot in Fedora:
$ sudo systemctl enable mysqld.service
On CentOS, Fedora or RHEL, the default installation of MySQL has no root password set, which means that anyone can log in to the root without entering any password. Thus, make sure to set the root password after installation. To set the root password, first install MySQL client (explained below), and run the following command.
$ mysqladmin -u root -p'oldpass' password 'newpass' (in case the current password is not empty)
Install MySQL Client in Linux
To install MySQL client in Ubuntu or Debian:
To install MySQL client in CentOS or RHEL:
To install MySQL client in Fedora:
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to set up Apt caching server on Ubuntu or Debian - February 7, 2016
- How to monitor OpenFlow messages with packet sniffer - February 2, 2016
- How to search multiple pdf documents for words on Linux - January 13, 2016