After the change of the Maria DB databases no longer connects with PhpMyAdmin

Issues related to applications and software problems
FabioB
Posts: 17
Joined: 2015/10/03 19:57:37
Location: Perugia (Italia)

After the change of the Maria DB databases no longer connects with PhpMyAdmin

Post by FabioB » 2018/06/06 15:34:46

Hello to all,
I have a Web Server with Centos 7.5.1804 which previously worked very well. I wanted to change the path of the Maria DB database folder and to do this I did:

Code: Select all

systemctl stop mariadb
rsync -av /var/lib/mysql /home/db
mv /var/lib/mysql /var/lib/mysql.bak
vi /etc/my.cnf

------------------------------------
[mysqld]
datadir=/home/db
socket=/home/db/mysql.sock
[client]
port=3306
socket=/home/db/mysql.sock
!includedir /etc/my.cnf.d
----------------------------------

systemctl start mariadb
Then I checked that the folder had been changed that way:

Code: Select all

mysql -u root -p
select @@datadir;
+----------------------------+
| @@datadir                  |
+----------------------------+
| /home/db/ |
+----------------------------+
1 row in set (0.01 sec)
The output is right!
The problem that now I can no longer connect via the browser to phpMyAdmin. The login window opens but does not recognize the password and so no CSM is installed.
I completely disabled selinux.
The password is recognized from the command line: I can access the under console of Mysql, create and delete dabase, create users, change passwords etc.
Please help me. Thank you!

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: After the change of the Maria DB databases no longer connects with PhpMyAdmin

Post by hunter86_bg » 2018/06/07 00:05:16

Disabling SELINUX is BAD.Learn to use it.

Also, check your phpmyadmin's configuration.

FabioB
Posts: 17
Joined: 2015/10/03 19:57:37
Location: Perugia (Italia)

Re: After the change of the Maria DB databases no longer connects with PhpMyAdmin

Post by FabioB » 2018/06/07 15:20:38

Thanks to answer. I know disable SELinux is bad but for now my priority is change database directory.
However before to disable SELinux I ran this commands without success:

Code: Select all

semanage fcontext -a -t mysqld_db_t "/home/db(/.*)?"
restorecon -R /home/db
What I have to do to check phpmyadmin's configuration?
Last edited by FabioB on 2018/06/07 16:31:38, edited 2 times in total.

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: After the change of the Maria DB databases no longer connects with PhpMyAdmin

Post by hunter86_bg » 2018/06/07 16:04:15

$cfg['Servers'][$i]['socket']
$cfg['Servers'][$i]['host']
$cfg['Servers'][$i]['port']
You need to define hostname & port or host (localhost) & socket.

FabioB
Posts: 17
Joined: 2015/10/03 19:57:37
Location: Perugia (Italia)

Re: After the change of the Maria DB databases no longer connects with PhpMyAdmin

Post by FabioB » 2018/06/07 16:32:11

In what file?

mghe
Posts: 766
Joined: 2015/11/24 12:04:43
Location: Katowice, Poland

Re: After the change of the Maria DB databases no longer connects with PhpMyAdmin

Post by mghe » 2018/06/07 17:12:50

FabioB wrote:
2018/06/07 16:32:11
In what file?
/etc/phpMyAdmin/config.inc.php

FabioB
Posts: 17
Joined: 2015/10/03 19:57:37
Location: Perugia (Italia)

Re: After the change of the Maria DB databases no longer connects with PhpMyAdmin

Post by FabioB » 2018/06/07 17:19:27

Forgive me but how I have to change that file in my case?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: After the change of the Maria DB databases no longer connects with PhpMyAdmin

Post by TrevorH » 2018/06/07 17:36:50

I suspect we may have gone away from the original topic a bit here.

Is there a reason why you are attempting to use a non-standard location for the mysql data files? A lot of things, including selinux, will be a lot easier if you can leave them in their original location. What is the driving force for changing it? If it's lack of disk space then can you post the output of the following commands, all except df need to be run as root:

df -h
pvs
vgs
lvs
fdisk -lu /dev/sd[a-z]
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

FabioB
Posts: 17
Joined: 2015/10/03 19:57:37
Location: Perugia (Italia)

Re: After the change of the Maria DB databases no longer connects with PhpMyAdmin

Post by FabioB » 2018/06/07 17:48:51

Yes my problem is the space. Now I have a new installation but I suspect that early it won't be enough.

Code: Select all

[root@webserver ~]# df -h
File system              Dim. Usati Dispon. Uso% Montato su
/dev/mapper/centos-root   50G  2,5G     48G   5% /
devtmpfs                 908M     0    908M   0% /dev
tmpfs                    920M     0    920M   0% /dev/shm
tmpfs                    920M  8,9M    911M   1% /run
tmpfs                    920M     0    920M   0% /sys/fs/cgroup
/dev/sda1               1014M  184M    831M  19% /boot
/dev/mapper/centos-home  147G  166M    147G   1% /home
tmpfs                    184M     0    184M   0% /run/user/0
[root@webserver ~]# pvs
  PV         VG     Fmt  Attr PSize    PFree
  /dev/sda2  centos lvm2 a--  <199,00g 4,00m
[root@webserver ~]# vgs
  VG     #PV #LV #SN Attr   VSize    VFree
  centos   1   3   0 wz--n- <199,00g 4,00m
[root@webserver ~]# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home centos -wi-ao---- 146,99g                                                
  root centos -wi-ao----  50,00g                                                
  swap centos -wi-ao----   2,00g                                                
[root@webserver ~]# fdisk -lu /dev/sd[a-z]

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Identificativo disco: 0x00076964

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   419430399   208665600   8e  Linux LVM
And then now I'm stubborn :x
I read a lot of guides who all say the same thing at the end, before writing here. It would seem so simple and yet something does not work

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: After the change of the Maria DB databases no longer connects with PhpMyAdmin

Post by TrevorH » 2018/06/07 19:28:19

So, really looking at that, with /home 1% used of 147GB, you would be far better to backup the data that's on there now. If it's using ext3 or ext4 then you can umount it then lvresize -r it smaller and free up the space it uses for use elsewhere. If it's xfs, which is the default, then it cannot be shrunk so you have to lvresize it and truncate the filesystem, reformat it and restore the data you previously backed up.

In either case, once you've shrunk /dev/mapper/centos-home (and restored its data if that is needed) then you have freespace left in the Volume Group. Now you can do one of two things - you can either lvresize -r your root filesystem and add the space to that or you can create an entirely new LVM LV and format that then use that as your /var/lib/mysql filesystem.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply