0

I have been tried many ways to install WordPress in my Ubuntu 22.04. However, I always receive errors.

This is about MySQL information:

alireza@OptiPlex-5090:~$ mysql --version
mysql  Ver 15.1 Distrib 10.6.12-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
alireza@OptiPlex-5090:~$ sudo apt-get install mysql-server
[sudo] password for alireza: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  galera-4 libconfig-inifiles-perl libdaxctl1 libdbd-mysql-perl libdbi-perl
  libmariadb3 libmysqlclient21 libndctl6 libpmem1 libterm-readkey-perl
  liburing2 socat
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  mysql-client-8.0 mysql-client-core-8.0 mysql-server-8.0
  mysql-server-core-8.0
Suggested packages:
  mailx tinyca
The following packages will be REMOVED:
  mariadb-client mariadb-client-10.6 mariadb-client-core-10.6 mariadb-server
  mariadb-server-10.6 mariadb-server-core-10.6
The following NEW packages will be installed:
  mysql-client-8.0 mysql-client-core-8.0 mysql-server mysql-server-8.0
  mysql-server-core-8.0
0 upgraded, 5 newly installed, 6 to remove and 0 not upgraded.
Need to get 0 B/21.6 MB of archives.
After this operation, 35.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
dpkg: warning: files list file for package 'mysql-apt-config' missing; assuming package has no files currently installed
(Reading database ... 412208 files and directories currently installed.)
Removing mariadb-client (1:10.6.12-0ubuntu0.22.04.1) ...
Removing mariadb-server (1:10.6.12-0ubuntu0.22.04.1) ...
Removing mariadb-server-10.6 (1:10.6.12-0ubuntu0.22.04.1) ...
Removing mariadb-client-10.6 (1:10.6.12-0ubuntu0.22.04.1) ...
Removing mariadb-client-core-10.6 (1:10.6.12-0ubuntu0.22.04.1) ...
Removing mariadb-server-core-10.6 (1:10.6.12-0ubuntu0.22.04.1) ...
Selecting previously unselected package mysql-client-core-8.0.
dpkg: warning: files list file for package 'mysql-apt-config' missing; assuming package has no files currently installed
(Reading database ... 411880 files and directories currently installed.)
Preparing to unpack .../mysql-client-core-8.0_8.0.32-0ubuntu0.22.04.2_amd64.deb ...
Unpacking mysql-client-core-8.0 (8.0.32-0ubuntu0.22.04.2) ...
Selecting previously unselected package mysql-client-8.0.
Preparing to unpack .../mysql-client-8.0_8.0.32-0ubuntu0.22.04.2_amd64.deb ...
Unpacking mysql-client-8.0 (8.0.32-0ubuntu0.22.04.2) ...
Selecting previously unselected package mysql-server-core-8.0.
Preparing to unpack .../mysql-server-core-8.0_8.0.32-0ubuntu0.22.04.2_amd64.deb ...
Unpacking mysql-server-core-8.0 (8.0.32-0ubuntu0.22.04.2) ...
Selecting previously unselected package mysql-server-8.0.
Preparing to unpack .../mysql-server-8.0_8.0.32-0ubuntu0.22.04.2_amd64.deb ...
Downgrade from (at least) 10.6 to 5.7 is not possible.
Warning: /etc/mysql/FROZEN already exists
MySQL has been frozen to prevent damage to your system. Please see /etc/mysql/FROZEN for help.
Unpacking mysql-server-8.0 (8.0.32-0ubuntu0.22.04.2) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_8.0.32-0ubuntu0.22.04.2_all.deb ...
Unpacking mysql-server (8.0.32-0ubuntu0.22.04.2) ...
Setting up mysql-client-core-8.0 (8.0.32-0ubuntu0.22.04.2) ...
Setting up mysql-server-core-8.0 (8.0.32-0ubuntu0.22.04.2) ...
Setting up mysql-client-8.0 (8.0.32-0ubuntu0.22.04.2) ...
Setting up mysql-server-8.0 (8.0.32-0ubuntu0.22.04.2) ...
Installing new version of config file /etc/mysql/debian-start ...
MySQL has been frozen to prevent damage to your system. Please see /etc/mysql/FROZEN for help.
Setting up mysql-server (8.0.32-0ubuntu0.22.04.2) ...
Processing triggers for man-db (2.10.2-1) ...
alireza@OptiPlex-5090:~$ sudo service mysql start
alireza@OptiPlex-5090:~$ sudo service mysql status
● mysql.service - LSB: Start and stop the mysql database server daemon
     Loaded: loaded (/etc/init.d/mysql; enabled; vendor preset: enabled)
     Active: active (exited) since Tue 2023-04-11 10:06:27 +03; 7s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 38901 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUC>
        CPU: 1ms

Apr 11 10:06:27 OptiPlex-5090 systemd[1]: Starting LSB: Start and stop the mysq> Apr 11 10:06:27 OptiPlex-5090 systemd[1]: Started LSB: Start and stop the mysql> lines 1-9/9 (END)...skipping...

alireza@OptiPlex-5090:~$ mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
alireza@OptiPlex-5090:~$ 
sotirov
  • 3,169
Alireza
  • 53
  • 1
    Does this answer your question? WordPress Installation Failed – user68186 Apr 11 '23 at 14:09
  • 1
    Your Error 2002 is because you are trying to sign in as root directly. This has not been possible with MySQL for 7+ years. You will need to connect like this: sudo mysql. You do not need to enter a username as part of this process. – matigo Apr 11 '23 at 14:10
  • alireza@OptiPlex-5090:~$ sudo mysql [sudo] password for alireza: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) alireza@OptiPlex-5090:~$ – Alireza Apr 11 '23 at 14:32
  • 1
    @Alireza Please edit your original question and add new information. Don't post additions as answers. They don't answer your question. – user68186 Apr 11 '23 at 14:48
  • I try to do same as your commend but i see following : alireza@OptiPlex-5090:~$ sudo mysql [sudo] password for alireza: sudo: mysql: command not found – Alireza Apr 12 '23 at 07:30

1 Answers1

0

Based on what you shared in your question and comments, it looks like you have created some mess. Initially you had MariaDB installed, then you installed MySQL. At one point you were getting ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) and after some tests you started to get mysql: command not found. If you don't have anything important on your database, I can recommend you to do some cleanup and reinstall the MySQL server and client.

Clean up

Warning: These commands will delete all your data stored on the MySQL server!

sudo apt purge mysql-*
sudo apt purge mariadb-*
sudo apt autoremove
sudo rm -rf /etc/mysql
sudo rm -rf /var/lib/mysql
sudo rm -rf /var/log/mysql

Installation

sudo apt install mysql-server
sudo apt install mysql-client

Usage

sudo mysql
sotirov
  • 3,169