By using AWS re:Post, you agree to the AWS re:Post Terms of Use

I can't connect in database after create a new instance by snapshot in Lightsail Lamp Stack

0

i try do this solution:

mysqld --skip-grant-tables --user=mysql --skip-external-locking --port=3306 --sock=/opt/bitnami/mariadb/tmp/mysql.sock

but:

mysqld: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mariadb/sbin/mariadbd' instead 2024-10-20 22:29:39 0 [Note] Using unique option prefix 'sock' is error-prone and can break in the future. Please use the full name 'socket' instead. mysqld: Can't create file '/opt/bitnami/mariadb/logs/mysqld.log' (errno: 13 "Permission denied") 2024-10-20 22:29:39 0 [Note] Starting MariaDB 11.4.3-MariaDB source revision 5ab81ffe0097a22a774957df28c5223cf0201de3 server_uid 6Ldcva7LeEW2AQgnE8mZRKRLr/Y= as process 5687 2024-10-20 22:29:39 0 [Note] InnoDB: !!! innodb_force_recovery is set to 1 !!! 2024-10-20 22:29:39 0 [Note] InnoDB: Compressed tables use zlib 1.2.13 2024-10-20 22:29:39 0 [Note] InnoDB: Number of transaction pools: 1 2024-10-20 22:29:39 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions 2024-10-20 22:29:39 0 [ERROR] mysqld: Can't create/write to file '/opt/bitnami/mariadb/tmp/ibE2SjhZ' (Errcode: 13 "Permission denied") 2024-10-20 22:29:39 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13 2024-10-20 22:29:39 0 [ERROR] mysqld: Can't create/write to file '/opt/bitnami/mariadb/tmp/ibGCTxCG' (Errcode: 13 "Permission denied") 2024-10-20 22:29:39 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13 2024-10-20 22:29:39 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 2024-10-20 22:29:39 0 [Note] InnoDB: Starting shutdown... 2024-10-20 22:29:39 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2024-10-20 22:29:39 0 [Note] Plugin 'FEEDBACK' is disabled. 2024-10-20 22:29:39 0 [Note] Plugin 'wsrep-provider' is disabled. 2024-10-20 22:29:39 0 [ERROR] Unknown/unsupported storage engine: InnoDB 2024-10-20 22:29:39 0 [ERROR] Aborting root@ip-172-26-12-139:/opt/bitnami/mariadb/conf# mysqld --skip-grant-tables --user=mysql --skip-external-locking --port=3306 --sock=/opt/bitnami/mariadb/tmp/mysql.sock mysqld: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mariadb/sbin/mariadbd' instead 2024-10-20 22:30:04 0 [Note] Using unique option prefix 'sock' is error-prone and can break in the future. Please use the full name 'socket' instead. mysqld: Can't create file '/opt/bitnami/mariadb/logs/mysqld.log' (errno: 13 "Permission denied") 2024-10-20 22:30:04 0 [Note] Starting MariaDB 11.4.3-MariaDB source revision 5ab81ffe0097a22a774957df28c5223cf0201de3 server_uid 6Ldcva7LeEW2AQgnE8mZRKRLr/Y= as process 5690 2024-10-20 22:30:04 0 [Note] InnoDB: !!! innodb_force_recovery is set to 1 !!! 2024-10-20 22:30:04 0 [Note] InnoDB: Compressed tables use zlib 1.2.13 2024-10-20 22:30:04 0 [Note] InnoDB: Number of transaction pools: 1 2024-10-20 22:30:04 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions 2024-10-20 22:30:04 0 [ERROR] mysqld: Can't create/write to file '/opt/bitnami/mariadb/tmp/ibj6ZN01' (Errcode: 13 "Permission denied") 2024-10-20 22:30:04 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13 2024-10-20 22:30:04 0 [ERROR] mysqld: Can't create/write to file '/opt/bitnami/mariadb/tmp/ibSnqVhH' (Errcode: 13 "Permission denied") 2024-10-20 22:30:04 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13 2024-10-20 22:30:04 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 2024-10-20 22:30:04 0 [Note] InnoDB: Starting shutdown... 2024-10-20 22:30:04 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2024-10-20 22:30:04 0 [Note] Plugin 'FEEDBACK' is disabled. 2024-10-20 22:30:04 0 [Note] Plugin 'wsrep-provider' is disabled. 2024-10-20 22:30:04 0 [ERROR] Unknown/unsupported storage engine: InnoDB 2024-10-20 22:30:04 0 [ERROR] Aborting

and, after i try access mariadb database: Enter current password for root (enter for none): ERROR 2002 (HY000): Can't connect to local server through socket '/opt/bitnami/mariadb/tmp/mysql.sock' (111)

oh, after run:

 netstat -an | grep 3306 

not listen the mariadb service

asked 2 months ago40 views
1 Answer
-1

It appears you're experiencing several issues with your MariaDB database after creating a new instance from a snapshot in AWS Lightsail LAMP stack. The problems you're encountering are likely related to permissions and database configuration.

The error messages indicate that the MariaDB service is unable to start due to permission issues. It can't create or write to necessary files and directories. This is evident from errors like "Permission denied" when trying to create log files or temporary files.

To resolve this issue, you should try the following steps:

  1. Check the permissions of the MariaDB directories and files. Ensure that the mysql user has the necessary permissions to read and write to these locations.

  2. Verify that the MariaDB service is actually running. You can use the command:

sudo systemctl status mariadb

or

sudo /opt/bitnami/ctlscript.sh status mariadb
  1. If the service is not running, try to start it:
sudo systemctl start mariadb

or

sudo /opt/bitnami/ctlscript.sh start mariadb
  1. Check the MariaDB error logs for more detailed information about why the service isn't starting:
sudo tail -f /opt/bitnami/mariadb/logs/mysqld.log
  1. Ensure that the database credentials in your application's configuration (like wp-config.php for WordPress) are correct and match the credentials for the new instance.

  2. If you're still unable to connect, try connecting to the database using the IP address instead of the socket:

mysql -h 127.0.0.1 -P 3306 -u root -p

If these steps don't resolve the issue, you may need to consider recreating the instance from the snapshot, as there might be some corruption in the database files or configuration.
Sources
Can not connect to mariadb after creating a new instance from a linux Lightsail snapshot | AWS re:Post
Can't access MySQL in a new instance created from a snapshot | AWS re:Post
Wordpress instance cloning with a snapshot, database connection error. What to do? | AWS re:Post

profile picture
answered 2 months ago
  • Not working, the log: 2024-10-20 22:26:56 0 [Note] Starting MariaDB 11.4.3-MariaDB source revision 5ab81ffe0097a22a774957df28c5223cf0201de3 server_uid 6Ldcva7LeEW2AQgnE8mZRKRLr/Y= as process 5648 2024-10-20 22:26:56 0 [ERROR] mysqld: Can't create/write to file './ddl_recovery.log' (Errcode: 13 "Permission denied") 2024-10-20 22:26:56 0 [ERROR] DDL_LOG: Failed to create ddl log file: ./ddl_recovery.log 2024-10-20 22:26:56 0 [ERROR] Aborting

    i received some errors, like: ERROR 2002 (HY000): Can't connect to server on '127.0.0.1' (115) and ERROR 2002 (HY000): Can't connect to local server through socket '/opt/bitnami/mariadb/tmp/mysql.sock' (2)

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions