Can't connect to database

Discussion in 'Server Operation' started by jimmie, May 20, 2024.

  1. Well-Known Member HowtoForge Supporter

    well, maybe you look into your configuration file and look out for !include directives referencing non existing folders.

    For reference, mine looks like this
    /etc/mysql/my.cnf usually has some included files and folders.
    But can't tell if they are missing for you due to the crash or if they were missing before and
    the server never got a restart?
    /etc/mysql # l *
    debian-start*  debian.cnf  mariadb.cnf  my.cnf@  my.cnf.fallback
    mysql.cnf  mysqldump.cnf
    50-client.cnf  50-mysql-clients.cnf  50-mysqld_safe.cnf  50-server.cnf  60-galera.cnf  60-server.cnf  provider_bzip2.cnf  provider_lz4.cnf  provider_lzma.cnf  provider_lzo.cnf  provider_snappy.cnf
  2. jimmie

    jimmie Member

    i found tis in

  3. jimmie

    jimmie Member

    im using ubuntu server 20.4
  4. jimmie

    jimmie Member

    been working on this all day, and have gotten a little closer. deleted all backup websites had over 90 backups for a single website, setting was set to make 30 copys every week for 7 months 1 tb hard drive.
    i need to get this working
  5. jimmie

    jimmie Member

    what is the code to copy the database(s) from the lib directiory?
    and how to get the websitefiles? i deleted backups from server.
    i feel im gonna have to redo the perfect server.
  6. jimmie

    jimmie Member

      GNU nano 4.8                /etc/alternatives/my.cnf
    # 2. "/etc/mysql/conf.d/*.cnf" to set global options.
    # 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
    # 4. "~/.my.cnf" to set user-specific options.
    # If the same option is defined multiple times, the last one will apply.
    # One can use all long options that the program supports.
    # Run program with --help to get a list of available options and with
    # --print-defaults to see which it would actually understand and use.
    # This group is read both both by the client and the server
    # use it for options that affect everything
    # Import all .cnf files from configuration directory
    !includedir /etc/mysql/conf.d/
    !includedir /etc/mysql/mariadb.conf.d/
  7. jimmie

    jimmie Member

    my store manager called me up to tell me the website was down, so i told her to reboot the server. it then came to me to try a backup i think, as it was backing up the database only, she rebooted.
  8. Well-Known Member HowtoForge Supporter

    remove that line.

    Aslo you should copy the /var/lib/mysql folder only after
    - you checked this is the only place where data, redo, undo, binlog and other things are stored.
    - database is defnitly turned off
    - you plan to bring it back up on a system as close / same as the original version.
    then you could use tools like
    rsync -avrP /var/lib/mysql root@otherserver:/var/lib/
    chown -R mysql:mysql /var/lib/mysql/
  9. jimmie

    jimmie Member

    this fixed it
  10. jimmie

    jimmie Member

    found this in monitor,
    Failed to restore MySQL backup /var/backup/web3/db_c1JNSFlooring20_2024-05-19_01-09.sql.gz, exit code 1 but ill remove it all seems good now
  11. Well-Known Member HowtoForge Supporter

    well yeah, removing the include or creating the empty folder ;)

    By the way, a good read:

    especially if you have a store?
    the basic mysqldump backup can be bad, depending on how much traffic / if traffic at all during backup times.

    Just imagine backing up the tables

    with mysqldump there is no guarantee for the backup to be consistent!
    it would backup articles table, then customers, then orders.
    What if the order would be different, or naming...
    an order could be in the backup but not the matching client
    or the article is still available in the backup but the customer bought it...
  12. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I have always assumed mysqldump or mariadb-dump to be atomic operation and produce a consistent copy. That should be basic database strategy. If changes were allowed during dump without shutting down the database the result would almost always be broken.
    What I now read about the dump program, it seems it locks all tables for writes, so the dump should have articles, customers and orders from the same point in time.
  13. Well-Known Member HowtoForge Supporter

    @Taleman well, if you can afford "stop the world" during backup, sure *dump can be used.
    I invite you though, to look in ISPConfig code for "lock-all-tables" or "lock-tables" or "opt". It would be a terrible strategy.
    And the default is to lock each table, but after that tbale is locked, it can receive updates, and the needed update on another table may well timeout or never happen, most code out there does not use transactions/rollback
    Last edited: May 21, 2024

Share This Page