seccion 8 (instalacion o configuracion de MySQL o MariaDB en el VPS)
instalr mariadb
>sudo apt install mariadb-serve
>mysql --version
iteractuar por cmd
>sudo mysql -u root -p
crear base de datos
create database snewapp_com;
create database api_snewapp_com;
...
show databases;
exit
asegurar instalación 9:30
sudo mysql_secure_installation
>Enter current password for root (enter for none):
>Set root password? [Y/n] : Y
>New password: 12345678
>Remove anonymous users? [Y/n] : Y
>Disallow root login remotely? [Y/n] : Y
>Remove test database and access to it? [Y/n] : Y
>Reload privilege tables now? [Y/n] : Y
* crear usuarios para las bases de datos
>sudo mysql -u root -p
>create user snewapp_com@localhost identified by 'AquiContraseña';
>create user api_snewapp_com@localhost identified by 'AquiContraseña';
>select user from mysql.user;
asignar usuario a una base de datos
>grant all privileges on snewapp_com.* to snewapp_com@localhost;
>grant all privileges on api_snewapp_com.* to api_snewapp_com@localhost;
>flush privileges;
example ========================================================
use u759233740_crio;
show tables;
** Crear usuarios para las bases de datos
> sudo mysql -u root -p
> select user from mysql.user;
> create user eco@localhost identified by 'AquiContraseña';
** Asignar usuario a una base de datos
> select user from mysql.user;
> GRANT ALL PRIVILEGES ON <database_name>.* TO <username>@localhost;
GRANT ALL PRIVILEGES ON ecommerce2.* TO eco@localhost;
> flush privileges;
===============================================
BACKUP
> sudo mysql -u <user> -p<pass> <name_bd> < <name_archivo.sql>
> sudo mysql -u eco -p1234 ecommerce2 < ecommerce.sql