Last updated on November 28, 2020 by Dan Nanni
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.
$ sudo apt-get install mysql-server
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.
$ sudo yum groupinstall "MySQL Database server" $ sudo chkconfig mysqld on
$ sudo yum install mysql-server $ 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 password 'newpass' (in case the current password is empty) $ mysqladmin -u root -p'oldpass' password 'newpass' (in case the current password is not empty)
After MySQL server installation, it is strongly recommend that you create a MySQL user account with appropriate access privileges (instead of logging in as root).
$ sudo apt-get install mysql-client
$ sudo yum groupinstall "MySQL Database client"
$ sudo yum install mysql
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean