Source: https://mariadb.com/kb/en/mariadb-package-repository-setup-and-usage/
sudo apt update && sudo apt install software-properties-common
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=mariadb-10.6
sudo apt update && sudo apt install mariadb-server
sudo systemctl restart mysql
ALTER DATABASE <db> CHARACTER SET = 'latin1' COLLATE = 'latin1_swedish_ci';
Source:
https://stackoverflow.com/questions/5551301
https://stackoverflow.com/questions/675289
sudo mysqldump example_db1 | mysql example_db2
CREATE DATABASE example_db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL PRIVILEGES ON example_db.* TO 'example_user'@'example_server' IDENTIFIED BY 'example_password';
FLUSH PRIVILEGES;
EXIT;
Source:
https://www.jetbrains.com/help/teamcity/set-up-external-database.html#MySQL
CREATE DATABASE teamcity_db COLLATE utf8mb4_bin;
CREATE USER teamcity IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON teamcity_db.* TO teamcity;
GRANT PROCESS ON *.* TO teamcity;
FLUSH PRIVILEGES;
EXIT;
DROP DATABASE <db>;
sudo mysqldump example_db > example_db.sql
for DB in $(sudo mysql -e 'show databases' -s --skip-column-names); do
sudo mysqldump $DB > "$DB.sql";
done
sudo mysql example_db < example_db.sql
SHOW DATABASES;
SELECT User, Db, Host from mysql.db;
USE DATABASE <db>;
SHOW TABLES;
SHOW TABLES FROM <db>;
CREATE USER <user> IDENTIFIED BY '<password>';
Change localhost
for server address if MariaDB is not installed locally.
GRANT ALL PRIVILEGES ON <database>.* TO 'username'@'localhost' IDENTIFIED BY 'password';
DROP USER <user>;
SELECT User FROM mysql.user;
with allowed location (see @'server'
in grant permission command):
SELECT host, user FROM mysql.user;
with password (hash):
SELECT host, user, password FROM mysql.user;
Migrate demosalon
to examplesalon
USE examplesalon_db;
UPDATE demosalon_options SET option_value = replace(option_value, 'https://demosalon.nl', 'https://examplesalon.nl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE demosalon_posts SET guid = replace(guid, 'https://demosalon.nl','https://examplesalon.nl');
UPDATE demosalon_posts SET post_content = replace(post_content, 'https://demosalon.nl', 'https://examplesalon.nl');
UPDATE demosalon_postmeta SET meta_value = replace(meta_value,'https://demosalon.nl','https://examplesalon.nl');
EXIT;
Source:
https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-ver15
Install SQL server (change Ubuntu version if needed)
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list)"
sudo apt update && sudo apt install mssql-server
sudo /opt/mssql/bin/mssql-conf setup
Install SQL Server command-line tools
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt update && sudo apt install mssql-tools unixodbc-dev
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
sudo apt update && sudo apt install postgresql postgresql-contrib
sudo nano /etc/postgresql/14/main/postgresql.conf
Look for listen_addresses
and change to '*'
to allow access on any address or (preferably) list the specific addresses:
# - Connection Settings -
...
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
Save and restart the Postgres service:
sudo systemctl restart postgresql
Look for port
and change (5432
is the default port):
# - Connection Settings -
...
port = 5432 # (change requires restart)
Save and restart the Postgres service:
sudo systemctl restart postgresql
sudo su - postgres pg_dump example_db | psql -U <db_user> example_db
sudo -u postgres psql
create database mydb;
create user myuser with encrypted password 'mypass';
grant all privileges on database mydb to myuser;
sudo su - postgres
createuser myuser
createdb mydb
psql
ALTER USER myuser WITH ENCRYPTED PASSWORD 'mypass';
GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser;
sudo su - postgres psql
DROP DATABASE <db>;
[sudo su - postgres] pg_dump [-h localhost] -U <db_user> example_db > example_db.sql
[sudo su - postgres] psql [-h localhost] -U <db_user> example_db < example_db.sql
or
[sudo su - postgres] pg_restore [-h localhost] -U <db_user> -d example_db -v example_db.sql
sudo su - postgres psql
\l
\l+
sudo nano /etc/postgresql/14/main/pg_hba.conf
This line:
local all postgres peer
Should be:
local all postgres md5
Peer authentication
The peer authentication method works by obtaining the client's operating system user name from the kernel and using it as the allowed database user name (with optional user name mapping). This method is only supported on local connections.
Password authentication
The password-based authentication methods are md5 and password. These methods operate similarly except for the way that the password is sent across the connection, namely MD5-hashed and clear-text respectively.If you are at all concerned about password "sniffing" attacks then md5 is preferred. Plain password should always be avoided if possible. However, md5 cannot be used with the db_user_namespace feature. If the connection is protected by SSL encryption then password can be used safely (though SSL certificate authentication might be a better choice if one is depending on using SSL).
sudo apt update && sudo apt install redis
redis-cli
FLUSHALL;
EXIT;