Установка MySQL8.0 и phpMyAdmin на CentOS 7

Установка Mysql8.0 на CentOS

 

yum install rh-mysql80-server

Запуск службы:

systemctl start rh-mysql80-mysqld

Включение клиента bash

scl enable rh-mysql80 bash

Запуск клиента:

mysql

Установка phpMyAdmin

 

sudo yum install phpMyAdmin

Настройка сервера Nginx для phpMyAdmin

sudo nano /etc/nginx/conf.d/phpMyAdmin.conf

Прописываем в файле конфигурации:

server {
        listen   9090;
        server_name 127.0.0.1;
        root /usr/share/phpMyAdmin;

location / {
        index  index.php;
        }

## Images and static content is treated differently
        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        access_log        off;
        expires           30d;
    }

location ~ /\.ht {
        deny  all;
        }

location ~ /(libraries|setup/frames|setup/libs) {
        deny all;
        return 404;
    }

location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin$fastcgi_script_name;
                    }
    }


Перезагружаем nginx, php-fpm

sudo systemctl restart nginx
sudo systemctl restart php-fpm

По умолчанию доступ в phpMyAdmin запрещен. Создадим пользователя для логина в phpMyAdmin

$mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.17 Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> mysql -u root -p // Запросить ввести пароль, жмем Enter
mysql> CREATE USER 'mysqluser'@'localhost' IDENTIFIED BY 'userpassword';
mysql> GRANT ALL PRIVILEGES ON * . * TO 'lora'@'localhost';
mysql> FLUSH PRIVILEGES;

Логинимся в phpMyAdmin под созданным юзером.