• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

mariadb

WordPress Read Only

November 29, 2020

Here’s how to create a WordPress site that’s read only. You will not be able to create, update and delete posts.

  1. Login to MySQL or MariaDB.
  2. Choose mysql database.
  3. Create a new user called ‘wpro’ for WordPress read only.
  4. Grant select permissions to all tables in ‘wordpress’ database.
  5. Flush privileges to commit your changes.
mariadb -u root -p
use mysql;
create user 'wpro'@'localhost' identified by 'yourpassword';
grant select on wordpress.* to 'wpro'@'localhost';
flush privileges;

mariadb -u root -p use mysql; create user 'wpro'@'localhost' identified by 'yourpassword'; grant select on wordpress.* to 'wpro'@'localhost'; flush privileges;

In MySQL or MariaDB, you have to terminate all commands with a semicolon.

Now edit your WordPress wp-config.php file. vim /var/www/wordpress/wp-config.php.

/** MySQL database username */
define('DB_USER', 'wpro');
 
/** MySQL database password */
define('DB_PASSWORD', 'yourpassword');

/** MySQL database username */ define('DB_USER', 'wpro'); /** MySQL database password */ define('DB_PASSWORD', 'yourpassword');

After saving the wp-config.php file, everything should work just like before, except that you will not be able to save, publish or delete posts, pages, or add or delete media files to your WordPress site. It’s working as intended.

Filed Under: Linux, WP Tagged With: create, grant, mariadb, mysql, read-only, select, user

Ubuntu 20.04 LTS Lamp Server

November 10, 2020

Here’s how to install a LAMP server on the latest Ubuntu 20.04 LTS.

Install Apache.

apt install apache2
systemctl status apache2
systemctl is-enabled apache2

apt install apache2 systemctl status apache2 systemctl is-enabled apache2

Install MariaDB.

apt install mariadb-server mariadb-client
systemctl status mariadb
systemctl is-enabled mariadb
mysql_secure_installation

apt install mariadb-server mariadb-client systemctl status mariadb systemctl is-enabled mariadb mysql_secure_installation

Install PHP.

apt install php libapache2-mod-php php-mysql
systemctl restart apache2

apt install php libapache2-mod-php php-mysql systemctl restart apache2

Enable ssl and mod_rewrite.

a2enmod ssl
a2enmod rewrite
systemctl restart apache2

a2enmod ssl a2enmod rewrite systemctl restart apache2

Filed Under: Linux Tagged With: apache, lamp, lts, mariadb, mod_rewrite, php, ssl, ubuntu 20.04

Install MariaDB on Ubuntu

November 23, 2014

MariaDB is a drop-in replacement for MySQL database. On most cases, you can just uninstall MySQL and install MariaDB and you are good to go. To keep up the two databases compatible, the MariaDB team are doing monthly merges with the MySQL code base making sure new features and fixes are kept up.

Uninstall MySQL

sudo apt-get purge mysql*
sudo apt-get autoremove

sudo apt-get purge mysql* sudo apt-get autoremove

Install MariaDB

sudo apt-get install mariadb-server mariadb-client -y

sudo apt-get install mariadb-server mariadb-client -y

Verify if MariaDB is running

sudo service mysql status

sudo service mysql status

Filed Under: Linux Tagged With: database, mariadb, mysql

  • Home
  • About
  • Archives

Copyright © 2023