Memasang MariaDB di CentOS 7


Langkah singkat instalasi mariadb di mesin CentOS 7:

  1. sudo yum install mariadb-server
  2. sudo systemctl enable mariadb
  3. sudo systemctl start mariadb

Akses mariadb:

mysql -u root -p

Secara default instalasi mariadb belum melakukan setting password, sehingga command di atas tinggal enter dan saat diminta password tinggal enter juga.

Akses root

Jika Anda lupa root password MariaDB, ia bisa reset (atau jika Anda ingin memberi password root pertama kali):

1. Stop the current MariaDB server instance, then restart it with an option to not ask for a password:

sudo systemctl stop mariadb
sudo mysqld_safe --skip-grant-tables &

2. Reconnect to the MariaDB server with the MariaDB root account:

mysql -u root

3. Use the following commands to reset root’s password. Replace password with a strong password:

use mysql;
update user SET PASSWORD=PASSWORD("password") WHERE USER='root';
flush privileges;
exit

4. Then restart MariaDB:

sudo systemctl start mariadb

Tuning

MySQL Tuning Primer can be used to optimize your MariaDB server. Ideally, the MariaDB instance should have been operating for at least 24 hours before running the tuner. The longer the instance has been running, the better advice MySQL Tuner will give.

1. The script needs the bc language installed:

sudo yum install bc

2. Download MySQL Tuner to your home directory and make it executable:

wget http://www.day32.com/MySQL/tuning-primer.sh
chmod u+x tuning-primer.sh

3. To run it:

sudo ./tuning-primer.sh

You will be asked if you would like to run the script against a different MySQL socket than/var/lib/mysql/mysql.sock. Select N. You will then be asked if you have your login. Enter y, then the credentials when asked.

Catatan

Agar mariadb/mysql dapat diakses dari komputer/IP lain dalam jaringan lokal (misal 192.168.56.0/24) maka jalan perintah berikut:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.56.%' IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;

Selamat ngoprek!

Sumber: https[:]//www[.]linode.com/docs/databases/mariadb/how-to-install-mariadb-on-centos-7

Leave a comment

Your email address will not be published. Required fields are marked *