How to Install MySQL on Fedora?
MySQL is one of the oldest and most reliable open-source (Available to all) Relational Database Management Systems. Trusted by Millions of users. SQL is used to communicate with Oracle, SQL-Server & MySQL. In MySQL, all data are arranged in the form of a table. MySQL is one of the best RDBMS being used for developing various web-based software Applications. MySQL and MariaDB packages provide the same files so they can conflict with each other. Make sure either you will install MySQL or MariaDB not Both.
Steps to Install MySQL in Fedora
Step 1: Update fedora packages/releases.
Before installing any package make sure we have updated our all repositories and apply all updates (if any). Fedora Linux uses dnf as a primary package manager. To update repositories type the below command into your terminal:
sudo dnf update
Command Explain: dnf is a software package manager that installs, updates, and removes packages on fedora. Here dnf update command will check all your dependencies and update them. Once dependencies get updated we can proceed to the installation part.
Step 2: Install MySQL Server.
Now run the following command in your terminal to install the Mysql Community server in your system. It will also install all other required dependencies.
sudo dnf install community-mysql-server -y
dnf is slower than apt and Pacman package manager, so take a cup of tea and have patience. It will take some time.
Additional: Cross-check MySQL services using systemctl
To cross-check or verify, whether MYSQL was installed correctly or not using,
systemctl status mysqld
Command Explain: Basically systemctl utility is used to start or stop any system services. It can also use for checking the status of services. In our case, it will check mysqld service status. Another way to check MySQL installation status is by pasting the below command in the terminal,
To auto-start MYSQL on each boot of our Linux Machine, use the below command,
sudo systemctl enable mysqld
Step 3: MySQL Secure Installation.
The default installation password is weak, even MySQL can start without any password and hackers can easily hack our database. So it is always advisable to do a secure installation of MySQL. For that type of Terminal,
After this, it will start with a blank password. Now our task is to validate Password, for doing this press Y/y.
There are 3 levels of password Validation. Recommended 1 (Medium) means your password should contain capital case, lowercase, a number, and a Special symbol. It’s not mandatory, we can select 2 or 0 instead of 1.
After password validation, this will ask for some permissions including Removing anonymous users, disabling the temporary passwords, and reloading tables. For secure installation answer all of them with ‘y’ or ‘Y’.
Great all set, Mysql installation part is done.
Starting MySQL in Fedora
After secure installation (STEP -3) we created a password for the root user. Now we are going to login MySQL server with root privilege using,
mysql -u root -p
Command Explain: Enter your host(root) password and your MySQL is ready to use.
Extra: How to create a User in Mysql
To create a user (other than root) copy the below query in your MySql Shell.
CREATE USER ‘your_userName’@’localhost’ IDENTIFIED BY ‘Password’;
Instead of your_userName, you have to type your UserName and your password. Now, Grant all permissions to the newly created users.
GRANT ALL PRIVILEGES ON *.* TO ‘your_userName’@’localhost’;
Instead of “deepUser” enter “your_userName”. To enter in deepUser type,
mysql -u deepUser -p
Update MySQL in Fedora Linux
To update MySQL in Fedora Linux paste the command in the terminal,
sudo dnf update mysql-server
Uninstall MySQL in Fedora Linux
To uninstall completely MySQL server paste the below command into the terminal,
sudo dnf remove mysql mysql-server
This was all about the installation part of MySQL in Fedora. In case anyone has some issues during installation feel free to ask in the comment section. Upvote/Like the solution if it helps you.
Please Login to comment...