├── README.md ├── instalar-mysql.md └── install-postgresql.md /README.md: -------------------------------------------------------------------------------- 1 | # Guia de Tuturiales de Youtube -------------------------------------------------------------------------------- /instalar-mysql.md: -------------------------------------------------------------------------------- 1 | # Instalar MySQL y MySQL Workbench en Ubuntu 2 | 3 | ## Instalar MySQL 4 | 1. Actualizar los repositorios 5 | 2. Instalar MySQL 6 | ~~~bash 7 | sudo apt-get install mysql-server 8 | mysql --version 9 | ~~~ 10 | 3. Ver manual de MySQL 11 | ~~~bash 12 | man mysql 13 | ~~~ 14 | 4. Acceso en local 15 | ~~~bash 16 | mysql -u root 17 | ~~~ 18 | 5. Configuración de usuario y contraseña 19 | ~~~bash 20 | CREATE USER 'alexroel'@'localhost' IDENTIFIED BY '123456'; 21 | ~~~ 22 | 6. Otorgar todos los privilegios al nuevo usuario: 23 | ~~~bash 24 | GRANT ALL PRIVILEGES ON *.* TO 'alexroel'@'localhost' WITH GRANT OPTION; 25 | ~~~ 26 | 27 | ## MySQL Workbench 28 | 1. Instalar Workbeanch desd la tienda 29 | 2. Habilitar los permisos para password para workbeanch 30 | 3. En MySQL tenemos que dar permisos para dar acceso al usuario root 31 | ~~~ 32 | mysql -u root 33 | ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; 34 | ~~~ 35 | 36 | ## Crear base de datos 37 | Para crear una base de datos en MySQL, puedes seguir los siguientes pasos: 38 | 39 | - Paso 1: Iniciar sesión en MySQL como usuario root o con otro usuario: 40 | ~~~bash 41 | mysql -u root -p #Para usuario root 42 | mysql -u alexroel -p # Para otro usuario 43 | ~~~ 44 | - Paso 2: Listar base de datos. 45 | 46 | ~~~bash 47 | SHOW DATABASES; 48 | 49 | +--------------------+ 50 | | Database | 51 | +--------------------+ 52 | | information_schema | 53 | | mysql | 54 | | performance_schema | 55 | | sys | 56 | +--------------------+ 57 | 4 rows in set (0.00 sec) 58 | ~~~ 59 | 60 | - Paso 3: Crear la base de datos: 61 | 62 | ~~~bash 63 | CREATE DATABASE todolist_db; 64 | ~~~ 65 | 66 | - Paso 4: Verificar la creación de la base de datos: 67 | 68 | ~~~bash 69 | SHOW DATABASES; 70 | 71 | +--------------------+ 72 | | Database | 73 | +--------------------+ 74 | | information_schema | 75 | | mysql | 76 | | performance_schema | 77 | | sys | 78 | | todolist_db | 79 | +--------------------+ 80 | 5 rows in set (0.00 sec) 81 | ~~~ 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /install-postgresql.md: -------------------------------------------------------------------------------- 1 | # Instalar PostgreSQL en Ubuntu 2 | 3 | ## Instalar PostgreSQL 4 | Con este comando se descargará y se instalara en su ultima versión. 5 | 6 | ~~~bash 7 | sudo apt-get -y install postgresql postgresql-contrib 8 | ~~~ 9 | 10 | Ingrese a PostgreSQL con el siguiente comando 11 | ~~~bash 12 | sudo su - postgres 13 | 14 | psql 15 | ~~~ 16 | 17 | Crea el usuario y la contraseña para administrar bases de datos con PostgreSQL. 18 | 19 | ~~~bash 20 | create user alexroel with password '123456'; 21 | ~~~ 22 | 23 | Dar permisos de super usuario a `alexroel`. 24 | ~~~bash 25 | alter user alexroel with superuser; 26 | ~~~ 27 | ## Crear tu primer base de datos con PostgreSQL 28 | Podemos crear nuestro primer base de datos con el siguiente comando para el usuario `alexroel`. 29 | 30 | ~~~bash 31 | create database tutorial_db owner alexroel; 32 | ~~~ 33 | 34 | Listar base de datos. 35 | ~~~bash 36 | \l 37 | 38 | \list 39 | ~~~ 40 | 41 | Para salir 42 | ~~~bash 43 | exit 44 | ~~~ 45 | 46 | 47 | ## Instalar PgAdmin 48 | Para instalar PgAdmin nesecitaremos `curl` y lo podemos instalar con el siguiente comando. 49 | 50 | ~~~bash 51 | sudo apt install curl 52 | ~~~ 53 | 54 | 55 | Instale la clave pública para el repositorio (si no lo hizo previamente): 56 | 57 | ~~~bash 58 | sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add 59 | ~~~ 60 | 61 | Cree el archivo de configuración del repositorio: 62 | 63 | ~~~bash 64 | sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update' 65 | ~~~ 66 | 67 | 68 | Instalar pgAdmin, instalar para los modos de escritorio y web: 69 | ~~~bash 70 | sudo apt install pgadmin4 71 | ~~~ 72 | 73 | ## Ejecutar PgAdmin4 74 | Buscas en tus aplicaciónes logo de PgAdmin o PotgreSQL, luego colocas los credenciales. a `Add New Server`, 75 | 76 | - En general Nombre de sevidor. 77 | - En Connection Host; `localhost` el pueto pordefecto. 78 | - En Username `alexroel` y `password` 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | --------------------------------------------------------------------------------