Mariadb not starting completely faild

zeeshan786

New member
Joined
Sep 24, 2021
Messages
12
hello experts i am new to directadmin i just installed DA few days ago and when i try to access phpmyadmin then i face the error "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)"

then my Mariadb server stopped working and i try to reinstall it but i got an error...

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
FATAL ERROR: Upgrade failed
/usr/bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
Restarting MySQL.
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.

sorry for my weak English and kindly help me ill be very thankful to you.
regards zeeshan.
error-mariadb.jpg
 
when i try to start and restart then also i face error
 

Attachments

  • mariadberro1.jpg
    mariadberro1.jpg
    363.5 KB · Views: 316
  • mariadberro2.jpg
    mariadberro2.jpg
    598.4 KB · Views: 146
DUCKDUCK go:

So please take care to look into how Directadmin is installing , with the ./build ... custombuild and not extra manually i guess / think






[SOLVED] Can't Connect to Local MySQL Server Through Socket '/var/run/mysqld/mysqld.sock


Have you ever faced an error 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock', while trying to log in to MySQL as any user? You can login to your MySQL via the following terminal command. mysql -u root -p or mysql -u root -pPassword Its recommended, not to...

www.zyxware.com









Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at DuckDuckGo




html.duckduckgo.com
 
when i try to start and restart then also i face error
About those errors, MariDB complain about unknown storage engine InnoDB and that's why it fail to start. First, can you confirm you have innodb_file_per_table in your /etc/my.cnf? Also, do you have any data in the SQL server? Do you have a backup for it?

Then, if you answer yes to above questions, try this:
mkdir /mysql_bkp
mv /var/lib/mysql/ib_logfile0 /mysql_bkp/
mv /var/lib/mysql/ib_logfile1 /mysql_bkp/

DO NOT delete those files until you are fine with the result and you have your SQL server up and running.
Then try start your MariaDB server. Any error?

Regards,
Dan
 
About those errors, MariDB complain about unknown storage engine InnoDB and that's why it fail to start. First, can you confirm you have innodb_file_per_table in your /etc/my.cnf? Also, do you have any data in the SQL server? Do you have a backup for it?

Then, if you answer yes to above questions, try this:
mkdir /mysql_bkp
mv /var/lib/mysql/ib_logfile0 /mysql_bkp/
mv /var/lib/mysql/ib_logfile1 /mysql_bkp/

DO NOT delete those files until you are fine with the result and you have your SQL server up and running.
Then try start your MariaDB server. Any error?

Regards,
Dan

here is the file /etc/my.cnf and i have fresh installed Direcadmin server there is no any of data can i re-install it or somethin g else??
 

Attachments

  • etc-cnf-file.jpg
    etc-cnf-file.jpg
    25.3 KB · Views: 130
DUCKDUCK go:

So please take care to look into how Directadmin is installing , with the ./build ... custombuild and not extra manually i guess / think






[SOLVED] Can't Connect to Local MySQL Server Through Socket '/var/run/mysqld/mysqld.sock


Have you ever faced an error 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock', while trying to log in to MySQL as any user? You can login to your MySQL via the following terminal command. mysql -u root -p or mysql -u root -pPassword Its recommended, not to...

www.zyxware.com









Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at DuckDuckGo




html.duckduckgo.com
when i try to access mysql using "mysql -u root -p" then also same error i mentioned in my post my servers mysql service is not starting when i try to start it say's faild to start mysql or mariadb.service etc.
 

Attachments

  • sql-error.jpg
    sql-error.jpg
    27.5 KB · Views: 97
OK fresh install can't help but important info needed for support

OS System and version used

Configuration at start of installation for Mariadb / mysql version or did you shortly after installation change version or to or from mariadb mysql ?

So did you change things for setup or after installation about mariadb?

If it is fresh install , please look over the docs for installation setup and configuration then better to start new install

While looking for problems now then cost time, and maybe not needed if installed all over from the beginning , also solving you maybe dont know it is really solved.
 
OK fresh install can't help but important info needed for support

OS System and version used

Configuration at start of installation for Mariadb / mysql version or did you shortly after installation change version or to or from mariadb mysql ?

So did you change things for setup or after installation about mariadb?
i didn't change anything after the installation as I mentioned above in my first post my servers PHPMyAdmin not logging in ... then
i face the error "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)"

then my Mariadb server stopped working and I try to reinstall it but I got an error...

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
FATAL ERROR: Upgrade failed etc now I have screenshots here you can see.
I removed the MariaDB from my system and try to install it again the same error I face. I am stuck I couldn't find any solution yet
 

Attachments

  • innodb2.jpg
    innodb2.jpg
    579.9 KB · Views: 254
  • innodb1.jpg
    innodb1.jpg
    340.1 KB · Views: 295
can i re-install it or somethin g else??
Yes, can be reinstalled but needs a bit of work. You will have to:
1. remove /var/lib//mysql if you don't have any data,

2. start the SQL server,

3. if it's 5.7 or 8 check (usually) /var/lib/mysql/[YOUR-HOSTNAME].err for the random root password generated at startup - or you could try and use the instructions on section B.3.3.2.2 on this page MySQL :: MySQL 5.7 Reference Manual :: B.3.3.2 How to Reset the Root Password,

4. secure your install with mysql_secure_installation - eventually setting the MySQL root password and - removing test database and (preferably) disallow remote root login,

5. run:
grep -i mysql /usr/local/directadmin/scripts/setup.txt
and note the MySQL password the user da_admin have set - let's say it was f7rag8ths9,

6. run something like this to setup the DA MySQL user:
echo "GRANT CREATE, DROP ON *.* TO da_admin@localhost IDENTIFIED BY 'f7rag8ths9' WITH GRANT OPTION;" > mysql.temp;
echo "GRANT ALL PRIVILEGES ON *.* TO da_admin@localhost IDENTIFIED BY 'f7rag8ths9' WITH GRANT OPTION;" >> mysql.temp;
/usr/bin/mysql --user=root --password < mysql.temp;

You should be asked to enter the MySQL root password you have reset on step 3 / 4 and after that, you're done...

Needs a bit of attention and you need to try and understand what each step does, don't just run commands blindly please.

Late edit:
AND, I may suggest adding some things to your [mysqld] section of your /etc/my.cnf... at least
local-infile = 0
innodb_file_per_table
symbolic-links = 0

Probably also "bind-address = 127.0.0.1" if you don't want to allow remote connections,
and "sql_mode = NO_ENGINE_SUBSTITUTION" maybe if your users come from older MySQL versions with old scripts,
and "max_connections = 500" or more depending on how many account you will have and how many connections to MySQL each will have,
and maybe "max_allowed_packet = 1G" if your server complains about allowed packet size during SQL imports,
and if you have any trouble with setting up MySQL user password check point 1. in my post here: https://forum.directadmin.com/threads/cough-panel-backup-restore-failing.64518/ which I DON'T really know if the right solution for it but it works for now like that...

Also you could just reinstall DA, but that usually means reinstall the OS too, doing all the settings again. That's usually the most error-proof way.

Regards,
Dan
 
Last edited:
No i did MEAN complete server and DA installation form start again so real fresh!

Further do some readings about the custombuild.

There you can install mariadb mysql the DA way with

so .build and that kind of stuff






If you do thing by hand separated from the DA way you get problems sometimes more installtions for same stuff and then real ........
 
Last edited:
Yes, can be reinstalled but needs a bit of work. You will have to:
1. remove /var/lib//mysql if you don't have any data,

2. start the SQL server,

3. if it's 5.7 or 8 check (usually) /var/lib/mysql/[YOUR-HOSTNAME].err for the random root password generated at startup - or you could try and use the instructions on section B.3.3.2.2 on this page MySQL :: MySQL 5.7 Reference Manual :: B.3.3.2 How to Reset the Root Password,

4. secure your install with mysql_secure_installation - eventually setting the MySQL root password and - removing test database and (preferably) disallow remote root login,

5. run:
grep -i mysql /usr/local/directadmin/scripts/setup.txt
and note the MySQL password the user da_admin have set - let's say it was f7rag8ths9,

6. run something like this to setup the DA MySQL user:
echo "GRANT CREATE, DROP ON *.* TO da_admin@localhost IDENTIFIED BY 'f7rag8ths9' WITH GRANT OPTION;" > mysql.temp;
echo "GRANT ALL PRIVILEGES ON *.* TO da_admin@localhost IDENTIFIED BY 'f7rag8ths9' WITH GRANT OPTION;" >> mysql.temp;
/usr/bin/mysql --user=root --password < mysql.temp;

You should be asked to enter the MySQL root password you have reset on step 3 / 4 and after that, you're done...

Needs a bit of attention and you need to try and understand what each step does, don't just run commands blindly please.

Late edit:
AND, I may suggest adding some things to your [mysqld] section of your /etc/my.cnf... at least
local-infile = 0
innodb_file_per_table
symbolic-links = 0

Probably also "bind-address = 127.0.0.1" if you don't want to allow remote connections,
and "sql_mode = NO_ENGINE_SUBSTITUTION" maybe if your users come from older MySQL versions with old scripts,
and "max_connections = 500" or more depending on how many account you will have and how many connections to MySQL each will have,
and maybe "max_allowed_packet = 1G" if your server complains about allowed packet size during SQL imports,
and if you have any trouble with setting up MySQL user password check point 1. in my post here: https://forum.directadmin.com/threads/cough-panel-backup-restore-failing.64518/ which I DON'T really know if the right solution for it but it works for now like that...


Regards,
Dan
yes i don't have any data in my server and i read your post carefully i remove "rm /var/lib/mysq" and then try to start but nothing happens same error like before mysqld.service not starting

"Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details."
 
but nothing happens same error like before
It's quite strange. Do you see the same error "Unknown/unsupported storage engine: InnoDB" in the startup log?

If you say it's just a new installation with no data, maybe it's a good idea to reinstall everything. That is most error-proof thing to do, but also usually means reinstalling your OS too.
 
Yes, can be reinstalled but needs a bit of work. You will have to:
1. remove /var/lib//mysql if you don't have any data,

2. start the SQL server,

3. if it's 5.7 or 8 check (usually) /var/lib/mysql/[YOUR-HOSTNAME].err for the random root password generated at startup - or you could try and use the instructions on section B.3.3.2.2 on this page MySQL :: MySQL 5.7 Reference Manual :: B.3.3.2 How to Reset the Root Password,

4. secure your install with mysql_secure_installation - eventually setting the MySQL root password and - removing test database and (preferably) disallow remote root login,

5. run:
grep -i mysql /usr/local/directadmin/scripts/setup.txt
and note the MySQL password the user da_admin have set - let's say it was f7rag8ths9,

6. run something like this to setup the DA MySQL user:
echo "GRANT CREATE, DROP ON *.* TO da_admin@localhost IDENTIFIED BY 'f7rag8ths9' WITH GRANT OPTION;" > mysql.temp;
echo "GRANT ALL PRIVILEGES ON *.* TO da_admin@localhost IDENTIFIED BY 'f7rag8ths9' WITH GRANT OPTION;" >> mysql.temp;
/usr/bin/mysql --user=root --password < mysql.temp;

You should be asked to enter the MySQL root password you have reset on step 3 / 4 and after that, you're done...

Needs a bit of attention and you need to try and understand what each step does, don't just run commands blindly please.

Late edit:
AND, I may suggest adding some things to your [mysqld] section of your /etc/my.cnf... at least
local-infile = 0
innodb_file_per_table
symbolic-links = 0

Probably also "bind-address = 127.0.0.1" if you don't want to allow remote connections,
and "sql_mode = NO_ENGINE_SUBSTITUTION" maybe if your users come from older MySQL versions with old scripts,
and "max_connections = 500" or more depending on how many account you will have and how many connections to MySQL each will have,
and maybe "max_allowed_packet = 1G" if your server complains about allowed packet size during SQL imports,
and if you have any trouble with setting up MySQL user password check point 1. in my post here: https://forum.directadmin.com/threads/cough-panel-backup-restore-failing.64518/ which I DON'T really know if the right solution for it but it works for now like that...

Also you could just reinstall DA, but that usually means reinstall the OS too, doing all the settings again. That's usually the most error-proof way.

Regards,
Dan
i try to clear all in /var/lib/mysql. and then initialize database directory using this command "mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql"
it works for me now my mariadb.service is starting normally but now i face another issuse
 

Attachments

  • mailerror.jpg
    mailerror.jpg
    39.1 KB · Views: 97
  • phpmyadminerr.jpg
    phpmyadminerr.jpg
    55.2 KB · Views: 97
I must appreciate everyone replying to me, It will be great if you guys can reply with more details so i can act without any issues thank you so much
 
Please do for all new install folowing all docs. SO OS and DA.

If no data on server that is the way to go for starting without problem box.

If others don't have this problem, it is hard to help.

If license you can open ticket at DA
 
Please do for all new install folowing all docs. SO OS and DA.

If no data on server that is the way to go for starting without problem box.

If others don't have this problem, it is hard to help.

If license you can open ticket at DA
i will try and thank you so much for the help
 
In the right side screenshot, it says access denied for user admin. Does user admin have a database?
Otherwise try logging in as user da_admin to see all databases.
 
In the right side screenshot, it says access denied for user admin. Does user admin have a database?
Otherwise try logging in as user da_admin to see all databases.

after solving the MySQL service issue I note that PHPMyAdmin and Roundcube not connecting databases here is a screenshot if any solution is available so please guide me any help would be appreciated.
 

Attachments

  • db.jpg
    db.jpg
    91.2 KB · Views: 114
  • users.jpg
    users.jpg
    88.5 KB · Views: 162
Back
Top