Mysql

Mysql Insert Into Select (Copy data from another table/database table)

Hello, has long seemed to me not to write again. But now I can write about copy data from another table or from table on another database.
First we must create database and the table:

mysql> create database learn;
mysql> use learn;
mysql> create table guest_book1( id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, name VARCHAR(50), tlp VARCHAR(15));
mysql> create table guest_book2( id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, name VARCHAR(50), tlp VARCHAR(15));
mysql> INSERT INTO guest_book1(name, tlp) VALUES('user 1', '089123456789'), ('user 2', '089223456789'), ('user 3', '089323456789'), ('user 4', '089423456789'), ('user 5', '089523456789');

(more…)

Advertisements

MySQL/MariaDB backup procedures, function, and triggers

Perhaps many people are asking about how to backup procedures, function, or triggers in MySQL/MariaDB. And now I know how to backup that using mysqldump command.
Example I have database with name exampledb, and if we perform regular backups, then the command is:

--if we use Linux
user@username~$ mysqldump -u root -p exampledb > /home/username/Downloads/exampledb.sql

--if we use windows
C:\Users\user>mysqldump -u root -p exampledb > C:\Users\username\Downloads

(more…)