Question

Importation of large database has wrecked MySQL on Ubuntu 20.04

Posted October 27, 2021 170 views
MySQLUbuntu 20.04

I tried importing a database weighing at 262 megabytes using mysql -u username -p databasename < sourcedatabasename.sql on my client’s server. The import command failed to complete.

I did not make any adjustments to the import size limit before importing the database. I am assuming this would cause issues.

Now when I try and access MySQL on my server using sudo mysql, I receive the following error: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ’/var/run/mysqld/mysqld.sock’ (2).

I have also received this error while trying to log into MySQL using the terminal: ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: YES).

I have tried following this help page with no success.

When I run sudo systemctl status mysql.service, the following is displayed.

mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2021-10-26 17:58:27 MDT; 46s ago
Process: 1714 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 1723 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Main PID: 1723 (code=exited, status=1/FAILURE)
Status: “Server startup in progress”

Oct 26 17:56:46 username systemd[1]: Starting MySQL Community Server…
Oct 26 17:58:27 username systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Oct 26 17:58:27 username systemd[1]: mysql.service: Failed with result 'exit-code’.
Oct 26 17:58:27 username systemd[1]: Stopped MySQL Community Server.

If I run sudo reboot, I can make it to step 5, but running this command sudo kill `cat /var/run/mysqld/mysqld.pid results in this message: cat: /var/run/mysqld/mysqld.pid: No such file or directory.

Could someone please assist me with getting MySQL back up and running on my server.

Cheers,

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @mikehermary,

Could you confirm that after trying to import 262MB of data backup file only your MySQL service stopped?

And what you seeing when you run sudo systemctl start mysql.service?

FYR, I am sharing the below links to guide you with MySQL installation and Import/Export:

https://www.digitalocean.com/community/tutorials/how-to-install-the-latest-mysql-on-ubuntu-20-04

https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-in-mysql-or-mariadb

Regards,
Rajkishore

by Mateusz Papiernik
Being able to import and export your database is an important skill to have. You can use data dumps for backup and restoration purposes, so you can recover older copies of your database in case of an emergency, or you can use them to migrate data to a new server or development environment. This tutorial will cover how to export the database as well as import it from a dump file in MySQL and MariaDB.
  • Hello,

    Yes, that was the case.

    When I enter the MySQL start command, nothing appears in the terminal window.

    After I performed a full reboot using sudo reboot, I ran sudo systemctl status mysql.service and saw that the server was running.

    *mysql.service - MySQL Community Server
    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
    Active: active (running) since Wed 2021-10-27 08:53:17 MDT; 9min ago
    Process: 757 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Main PID: 854 (mysqld)
    Status: “Server is operational”
    Tasks: 37 (limit: 2343)
    Memory: 429.1M
    CGroup: /system.slice/mysql.service
    └─854 /usr/sbin/mysqld

    Oct 27 08:53:14 username systemd[1]: Starting MySQL Community Server…
    Oct 27 08:53:17 username systemd[1]: Started MySQL Community Server.*

    When I tried to run sudo mysql after the reboot, the following error is returned: ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO).

    When I tried to run mysql after the reboot, the following error is returned: ERROR 1045 (28000): Access denied for user 'databaseuser’@'localhost’ (using password: NO)

    Hope this additional information helps.

    Cheers,

  • Hello,

    I have figured out that mysql -u root -p and mysql -u username -p both work and allow me to access the MySQL shell using terminal and log into phpMyAdmin through the browser.

    Using sudo mysql no longer works for some reason. I have tried following this help article, but it has not solved my issue for connecting using sudo.

    Any ideas on what would have caused sudo mysql to stop working.

    Cheers,