Proyecto SO2 montar el disco para el SQL
!/bin/bash
sudo mount /dev/sda3 /mnt/disco
si no esta
mkdir disco3 en cd /mnt
Paso 2
cd /etc/sytemd/System
pico sda3.service
[Unit] Description=Montar la particion sda3 en el directorio /mnt/disco3
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/montar_disco3.sh
Paso 3
Formatear el disco para instalar MYSQL
Paso 4 hacer una actualización
Ya despues de instalar Mysql y que podamos entrar
#!/bin/bash
echo "**********************************"
echo "*** Menu de Opciones LPIC 1 ***"
echo "***********************************"
echo "1. Crear Backups "
echo "2. Enviar Correo"
echo "3. Descargar Correo"
echo "8. Salir "
read -p "Digite la opcion [1-3] :" op
if [ $op = "1" ]
then
clear
/home/angel/unah/generarrespaldo.sh
sleep 5
/home/angel/unah/menu.sh
elif [ $op = "2"]
then
clear
/home/angel/unah/enviaremail.sh
sleep 3
/home/angel/unah/menu.sh
elfi [ $op= "3" ]
then
clear
/home/angel/unah/descargarcorreo.sh
sleep 5
/home/angel/unah/menu.sh
elif [ $op="8"]
then
exit 1
else
echo "Opcion Incorrecta, Digite de nuevo "
fi
Configuraciones de mysql
./backupunah.sh: line 7: PATH: command not found
./backupunah.sh: line 8: unexpected EOF while looking for matching `''
./backupunah.sh: line 21: syntax error: unexpected end of file
root@angelpda:/home/angel# pico backupunah.sh
root@angelpda:/home/angel# ./backupunah.sh
mysqldump: [Warning] Using a password on the command line interface can be
insecure.
mysqldump: Got error: 1045: Access denied for user 'developer'@'localhost' (using
password: YES) when trying to connect
Error en el proceso de backup
root@angelpda:/home/angel# YES
YES: command not found
root@angelpda:/home/angel# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.42-0ubuntu0.22.04.2 (Ubuntu)
Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databaseM
->
->
->
->
->
->
->
-> bye
-> ^C
mysql> DBye
->
-> ^C
-> ^C
mysql> q
-> ^C
mysql>
mysql> exit
Bye
root@angelpda:/home/angel# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.42-0ubuntu0.22.04.2 (Ubuntu)
Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0,00 sec)
mysql> use mysql ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select user, host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| debian-sys-maint | localhost |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
5 rows in set (0,00 sec)
mysql> create user 'developer'@'%' identified by 'Developer+2025'
-> create user 'developer'@'%' identified by 'Developer+2025' ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'create
user 'developer'@'%' identified by 'Developer+2025'' at line 2
mysql> create user 'developer'@'%' identified by 'Developer+2025' ;
Query OK, 0 rows affected (0,03 sec)
mysql> grant all privileges on *.* to developer'@'%';
'> grant all privileges on *.* to developer'@'%';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ''@'%';
grant all privileges on *.* to developer'@'%'' at line 1
mysql> grant all privileges on *.* to developer'@'%';
grant all privileges on *.* to developer'@'%';
'> flush privileges
'> grant all privileges on *.* to developer'@'%';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ''@'%';
flush privileges
grant all privileges on *.* to developer'@'%'' at line 1
mysql> GRANT ALL PRIVILEGES ON *.* TO 'developer'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0,02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0,00 sec)
mysql> select user ,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| developer |% |
| debian-sys-maint | localhost |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
6 rows in set (0,00 sec)
mysql> show data