Hiển thị các bài đăng có nhãn mysql. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn mysql. Hiển thị tất cả bài đăng

Install and Configure MariaDB on Ubuntu

I. Installation

In your terminal execute the following commands:

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64] http://mirror.zol.co.zw/mariadb/repo/10.3/ubuntu bionic main'
sudo apt update
sudo apt -y install mariadb-server mariadb-client

You should be prompted to set your password.

Try myql -u root -p, if it does not work we need to configure the root user.

II. Configuration
Go back to your terminal and execute the following commands:

sudo mysql -u root
SELECT User,Host FROM mysql.user; # notice that root is assigned to localhost not %
DROP USER 'root'@'localhost';
CREATE USER 'root'@'%' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Exit mysql and connect without using sudo.

In case something goes wrong. Here's how you can uninstall MariaDB

apt-get remove --purge mariadb-server mariadb-client 
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mariadb-server mariadb-client
sudo apt-get --purge remove "mysql*"
sudo rm -rf /etc/mysql

Open /etc/apt/sources.list and remove all instances of MariaDB.

Then finally run sudo apt update.