Announcement

#1 2017-12-13 23:23:34

p2ranger
Member
2013-12-21
13

Trouble with MySQL

Hello

I recently updated my Ubuntu server from 14.04 to 16.04. Not everything went smoothly. One of the problems was MySQL. I had to reinstall MySQL and delete everything to get it running again.

Before I deleted everything, I coppied the piwigo folder from /var/lib/mysql so I could get Piwigo working again

After copying the folder back, I can not get Piwigo working again. I've tried just copying the folder over without creating a database and I've also tried creating the database and then copying the contents of the piwigo folder into there after MySQL created the folder. I have also repaired the tables. All permissions and ownerships are correct. This is what I get when I try to visit Piwigo:

Code:

Warning:  [mysql error 1146] Table 'piwigo.piwigo_meta' doesn't exist
SELECT id,metaname,metaval FROM piwigo_meta WHERE metaname IN ('author', 'keywords', 'Description', 'robots'); in /media/raid1/www/piwigo/include/dblayer/functions_mysqli.inc.php on line 845


Fatal error: Uncaught Error: Call to a member function fetch_assoc() on boolean in /media/raid1/www/piwigo/include/dblayer/functions_mysqli.inc.php:226 Stack trace: #0 /media/raid1/www/piwigo/plugins/meta/main.inc.php(89): pwg_db_fetch_assoc(false) #1 /media/raid1/www/piwigo/include/functions_plugins.inc.php(279): add_meta() #2 /media/raid1/www/piwigo/include/page_header.php(99): trigger_notify('loc_end_page_he...') #3 /media/raid1/www/piwigo/index.php(367): include('/media/raid1/ww...') #4 {main} thrown in /media/raid1/www/piwigo/include/dblayer/functions_mysqli.inc.php on line 226

I would rather not reinstall Piwigo if I can help it. I'm assuming its a MySQL problem but I don't know what the solution is.

Thanks for any help

Jason

Piwigo version: 2.9.2
PHP version: 7.0.22
MySQL version: 5.720
Piwigo URL: http://private

Offline

 

#2 2017-12-15 03:35:10

windracer
Member
St. Pete, FL
2014-12-28
448

Re: Trouble with MySQL

Copying the folder isn't really the best/preferred method of making a backup of your MySQL databases. My guess is that the piwigo database doesn't actually exist (to MySQL).

Try doing a 'show databases' in MySQL and see if 'piwigo' is listed:

Code:

21:31:50 /var/lib:$ sudo mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 20971
Server version: 5.7.20-0ubuntu0.17.10.1 (Ubuntu)

Copyright (c) 2000, 2017, 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> show databases;

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| phpmyadmin         |
| piwigo             |
| sys                |
+--------------------+
6 rows in set (0.00 sec)

mysql>

Offline

 

#3 2017-12-15 09:06:36

eliz82
Member
Romania
2016-04-27
281

Re: Trouble with MySQL

well , copying the mysql folder works if you are not on a production server. (i have tested myself and i had no problems)

on a production server where data can be written all the time in the database, is much better to use msql commands for backup.
https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html
because mysql command automatically lock the database -> make the export -> unlock database.

so it prevents for incomplete data written exactly when you are making the backup. that incomplete written data can corrupt the database.

for automatic backups you can install Cron, and run a shell script once a week/month
http://piwigo.org/forum/viewtopic.php?p … 76#p166276

@edit:  i forgot to say you can also use direct folder copy for database backup but you can stop the mysql service temporarily. https://askubuntu.com/questions/82374/h … sql-server .so this also works on production server if you now what you are doing.

Last edited by eliz82 (2017-12-15 09:11:20)

Offline

 

#4 2017-12-17 08:08:08

p2ranger
Member
2013-12-21
13

Re: Trouble with MySQL

the piwigo database does show up

I realize that my copying just the directory for piwigo wasn't the best option, but that was what I could get at the time before I had to purge my MySQL install

I looked through the files for installing Piwigo and I couldn't find the part that recreates the piwigo database and its tables. If I could try that, I could try copying in the contents of my directory into what gets created.

Thanks

Jason

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact