Skip to main content

MySQL, MariaDB


Wordpress: Sessions löschen

DELETE
FROM `wp_options`
WHERE option_name LIKE '_wp_session%'

Datenbank kopieren

mysql> CREATE DATABASE testdb_copy;  
mysql> SHOW DATABASES;  

mysqldump -u root -p testdb > D:\Database_backup\testdb.sql  

mysql -u root -p testdb_copy < D:\Database_backup\testdb.sql  

mysql> SHOW TABLES;  

Zugriff von außen

Original: https://webdock.io/en/docs/how-guides/database-guides/how-enable-remote-access-your-mariadbmysql-database

You can do it by editing the MariaDB default configuration file. Look for "bind-address" directive in these two locations (make the change in whichever file you find that directive). You can open the file using your favorite text editor:

$ nano /etc/mysql/my.cnf

OR

$ sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Change the value of the bind-address from 127.0.0.1 to 0.0.0.0 so that MariaDB server accepts connections on all host IPv4 interfaces.

bind-address = 0.0.0.0

Save and close the file when you are finished. Then, restart the MariaDB service to apply the changes:

$ sudo systemctl restart mariadb

Grant Access to a User from a Remote System

YouIn canthis nowsection, verifywe will create a new database named wpdb and a user named wpuser, and grant access to the remote system to connect to the database wpdb as user wpuser.

First, log in to the MariaDB listening statusshell with the following command:

$ mysql -u admin -p

Provide your admin (root) password as shown in the Webdock backend and when you get the prompt create a database and user with the following command:

MariaDB [(none)]> CREATE DATABASE wpdb;
MariaDB [(none)]> CREATE USER  'wpuser'@'localhost' IDENTIFIED BY 'password';

Next, you will need to grant permissions to the remote system with IP address 208.117.84.50 to connect to the database named wpdb as user wpuser. You can do it with the following command:

MariaDB [(none)]> GRANT ALL ON wpdb.* to 'wpuser'@'208.117.84.50' IDENTIFIED BY 'password' WITH GRANT OPTION;

Next, flush the privileges and exit from the MariaDB shell with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;