I had deleted all databases from mysql. Some problem have arisen. I can’t access mysql properly. I had created a mysql database manually.
~ mysql -u root ✔ 9s
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.6.3-MariaDB Arch Linux
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.001 sec)
MariaDB [(none)]> use databases;
ERROR 1049 (42000): Unknown database 'databases'
MariaDB [(none)]> 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
MariaDB [mysql]> show tables;
+-----------------+
| Tables_in_mysql |
+-----------------+
| general_log |
+-----------------+
1 row in set (0.000 sec)
I am using --skip-grant-tables. I had deleted MariaDB multiple times. I had deleted from Add/Remove Software also. But, whenever I install again I just get what I had earlier. Everything isn’t removing properly. Or, I can’t reinstall everything properly. I wanted to hard remove MariaDB. But, I can’t find any other way to remove. I usually use pacman -R.
The mysql database was created on the installation of Mariadb and if you delete /var/lib/mysql, Mariadb needs to recreated the content. Delete the folder too.
Sorry! I had removed mysql not only mysql I had removed information_schema either. When I had reinstalled again and again and again… Then, I got information_schema but, not mysql. I have created that database manually by following a SO answer.
ERROR 2002 (HY000): Can’t connect to local server through socket ‘/run/mysqld/mysqld.sock’ (111)
I got above error. Enter current password for root (enter for none): I know that I have installed it now so, there’s no password So, I clicked enter. Then, I got error. I again tried using my root user password. Although, I got same error. Then, I tried root as password.
I ran exactly theses commands and that worked (don’t forget sudo, I forgot them in some commands in the post). Try again and on mysql_secure_installation, you need sudo potentially.
I have run sudo mysql_secure_installation either. But, getting same error
I have run something now…
~ mysqld --initialize 1 ✘
2021-08-10 0:01:53 0 [Note] mysqld (mysqld 10.6.3-MariaDB) starting as process 13198 ...
2021-08-10 0:01:53 0 [Warning] Can't create test file /var/lib/mysql/istiak-4291zfv.lower-test
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 "Permission denied")
2021-08-10 0:01:53 0 [ERROR] Aborting
I think the above error stack-trace may helpful to find problem. I was looking at it (SO answer)
~ mysqladmin variables ✔
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local server through socket '/run/mysqld/mysqld.sock' (111)'
Check that mariadbd is running and that the socket: '/run/mysqld/mysqld.sock' exists!
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (111)
I have started MariaDB either. When I tried mysqld (sudo msyqld) with sudo I got following error.
2021-08-11 16:17:30 0 [Note] mysqld (mysqld 10.6.3-MariaDB) starting as process 3609 ...
mysqld: Please consult the Knowledge Base to find out how to run mysqld as root!
2021-08-11 16:17:30 0 [ERROR] Aborting