mysql.proc does not exist on database restore - mysql

A couple of months ago I upgraded my Lubuntu from 12.10 to 16.10, seemingly without any problems.
A short while later mysqld crashed while I was trying to create a new database, and wouldn't restart.
After some testing I found that I had to add innodb_force_recovery=2 to the mysql.cnf file to get it up and running.
Mysqlcheck cannot find any errors, so I have dumped all databases to a backup file, and the result looks correct.
Some experimentation has shown the problem probably is located in the file ibdata1, removing this allows mysqld to start and run normally, but a lot of tables naturally doesn't exist.
I understand there are no way to repair the innodb databases, so I have emptied the mysql data directory (I do have a backup), making mysqld rebuild the system databases. But when I try to restore my dump file it creates most of my databases then stops with the error "mysql.proc does not exist".
I'm stuck here, and have been unable to find any clue on how to solve this problem on the net.
Does anyone have an idea how to solve this problem?
Thanks.

The problem has been solved, it seems it was necessary to run mysql_upgrade after the initialization and before the restore of the backup.

Related

Will mysql_install_db delete existing databases?

Using Homebrew on MacOS...
When starting mySQL using mysql.server start I receive the following error
ERROR! The server quit without updating PID file (/usr/local/var/mysql/Tims-iMac.local.pid).
I've been reading lots of posts on how to solve this issue, none of which have worked, though I keep coming across the following advice:
unset TMPDIR
mysql_install_db
If I do this, will it delete all of my existing databases?
If it will delete them, how do I backup and restore the databases after a new mySQL install?
According to the docs the answer is no, it does not, however, as tadman suggests you should do a backup prior to performing any such maintenance.
To backup your databases use the mysqldump command. And to restore you can use the mysql command line tool.

LAMPP Error #1932 after update: Tables don't exist

I recently updated my Ubuntu server, and now all the tables in my database are telling me they don't exist.
I had some issues with phpMyAdmin after restarting the machine, so I reinstalled it and eventually got it working again. I can see the database and it lists all of the tables, but as soon as I click on any it says "Table xxx.xxxx doesn't exist in engine". I can see the files are still there in nautilus.
I have done a lot of research and I see some general information about rebuilding the tables, but I don't usually do anything in a LAMPP environment and I can't lose any of this data, so I've been wary about running some of the commands (especially the ones that include DROP).
I am running XAMPP for Linux 5.6.23 and phpMyAdmin 4.5.2 on ubuntu 16.04
I did end up solving this eventually. I used https://recovery.twindb.com/ to recover the frm files and rebuilt the database tables one at a time using the MySQL CLI. I removed and reinstalled XAMPP and phpMyAdmin and finally got it all working after dumping and then importing.

Recovering MySql Database after uninstalling WAMP?

I uninstalled WAMP on Win7. It removed everything but kept the data folder containing my database. After installing WAMP again on same directory, I thought it will recover MySQL database but it didn't.
It does show me my database and when I expand it in phpMyAdmin, I can see the tables but when I try to query them, it says, #1146 - Table 'tablename' doesn't exist
I searched and found a couple of posts. This post is close enough but it is for Linux and not exactly my case.
Any help will be appreciated.
UPDATE 1:
I tried repeating the steps mentioned here
Stopped MySQL service,
Renamed old database directory,
Started MySQL service,
Created new database with same name, and replaced all database files on it
Still got the same error.
UPDATE 2:
I tried repeating the steps mentioned here as well
Still getting the same error.
UPDATE 3:
Examining .err file revealed the below error:
[Warning] InnoDB: Cannot open table testdb/rules from the internal data dictionary of InnoDB though the .frm file for the table exists.
UPDATE 4:
CHECK TABLEtablename; resulted in following errors
Warning InnoDB: Tablespace is missing for table 'db/tablename'
Error Table 'db.tablename' doesn't exist
status Operation failed
Why don't you uninstall and then reinstall WAMP with backup datafiles in data directory. sometimes it solves problem.
I suggest you to always export your DB before doing any serious modifications.
Here is a thread for how to recover data This may be helpful to you

Restore InnoDB database

Today when trying to start mysql service, I got this error :
"mysql: job failed to start"
I needed to work with mysql, so I made a backup of my data directory (/var/lib/mysql) and reinstalled the server (mysql-server-5.6), note that I couldn't have used mysqldump because mysql wouldn't start, even with innodb_force_recovery>0
Now mysql starts just fine, but if I put back the old data directory, it shows the error mentioned before. I concluded that the problem comes from corrupted data
Now all I have is this data folder (containing ibdata1, ib_logfile* and such) and I want to restore all the data (not only the structure).
Thank you
"Old" and "new" are the same version 5.6? Try to check privilege of files, folders too.
Good luck.
I hope you tried all innodb_force_recovery values including 6. If MySQL still doesn't start follow instructions in my post https://twindb.com/recover-corrupt-mysql-database/ . There is a web interface to the data recovery toolkit on https://recovery.twindb.com/, you can upload and recover the database there if you are ok uploading the data.

MySQL corrupts after every server restart

I Have a bit of an odd problem. I am running MySQL and Drupal site from a windows environment (not by choice but it is just how things have worked out) and most of the time the site is fine however every time the server is restarted (from updates or for maintenance) The MySQL Database will corrupt.
When I log in to MySQL Work bench I notice that the server status is stopped and when I try to start it I get the error:
ERROR Fatal error: Can't open and lock privilege tables: Can't find file: 'user' (errno: 2 - No such file or directory)
and then MySQL Server fails to restart.
The only way around this problem is to delete data folder in the ProgramData/MySQL and then replace it with a backup from a fresh install of MySQL then import a backup of my tables and recreate my users.
My Question is what is causing MySQL to corrupt at every sever restart and what can I do to prevent this happening moving forward?
This occurs when mysql can not find or do not have permissions to user.MYD or user.MYI or user.frm in the data directory. When you start mysql, make sure that these files exist in data directory. You can just copy those files when mysql does not start
This worked for me:
Stick with the 32 bit.
Uninstall and make sure you then DELETE the mysql-data folder and all its subfolders before installing, and prefer to use the 32 bit (sometimes 64 bit versions are the problem).
(Source)