20

I open workbench and connect to a local database on XAMPP and when open the connection the schema show the error message:

"tables could not be fetched"

5
  • Are you 100% sure that the credentials that you are using are correct ? Jun 12, 2019 at 14:34
  • 1
    Dear @LucaStucchi, I've approved your edit, but note that greetings, thank-you and other help-me message can be removed as well. And it's best to format messages with a >. See my subsequent edit.
    – Cœur
    Jun 12, 2019 at 14:57
  • My credentials are root and no password. I dont know why workbench cant fetch Jun 12, 2019 at 15:32
  • That might be a bug that was solved in the upcomming 8.0.17 version. Jun 13, 2019 at 6:44
  • SQL Workbench/J and MySQL Workench are two very different things. Which one are you really using?
    – user330315
    Jun 15, 2019 at 0:18

13 Answers 13

20

run this command on terminal

mysql_upgrade -u root -p
1
  • Adding a bit of context to this command; the mysql_upgrade is a compatibility checker, it makes sure tables, privileges etc. is brought in line with the version of MySQL/MariaDB. Incompatibilities can happen when upgrading a major version and hence it's also recommended to run this command after an upgrade (hence the name!).
    – chjortlund
    Sep 29, 2021 at 7:23
13

For XAMPP, this worked for me - run this on terminal:

sudo /Applications/XAMPP/xamppfiles/bin/mysql_upgrade

Disconnect then reconnect to your db.

13

Run this command on terminal

sudo /opt/lampp/bin/mysql_upgrade

And as per the comment by @jonathan-delean , you might need to run this instead:

sudo /opt/lampp/bin/mysql_upgrade -u root -p
2
  • 3
    sudo /opt/lampp/bin/mysql_upgrade -u root -p Jun 12, 2020 at 15:04
  • 1
    Why? What does it do? It does not fix it for me. I have this issue with a fresh install of latest 5.7.x, and a workbench of latest 8.0.x. It seems they are not compatible, or this latest workbench has an issue.
    – nl-x
    Jul 21, 2021 at 13:26
2

First, locate the directory of which Xampp is installed at. In linux you can just type this in a terminal:

whereis xampp

In my case (btw I use arch, jk) it was located at /opt/lampp/bin . If you're using windows, you may find it under a different location, like in C:\Program Files\xampp\bin

Next, locate the file mysql_upgrade and execute it as an administrator or a sudo. If you're using Linux: cd /opt/lampp/bin then sudo ./mysql_upgrade

According to MySQL documentation:

Each time you upgrade MySQL, you should execute mysql_upgrade, which looks for incompatibilities with the upgraded MySQL server: It upgrades the system tables in the mysql schema so that you can take advantage of new privileges or capabilities that might have been added. It upgrades the Performance Schema, INFORMATION_SCHEMA, and sys schema. It examines user schemas.

So I believe mysql_upgrade should resolve the problem. It worked for me before.

More on mysql_upgrade here:

4.4.5 mysql_upgrade — Check and Upgrade MySQL Tables

1

That's because the latest XAMPP use MariaDB and MYSQL Workbench is using MYSQL Database, so they are not fully compatible, raising that error for example.You can try to downgrade to some of the previous XAMPP versions.

1

for macOS users run this on terminal: sudo /Applications/XAMPP/bin/mysql_upgrade this worked for me

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Apr 27, 2022 at 1:06
0

For MacOS users:

sudo /Applications/XAMPP/bin/mysql_upgrade
0

I created another Connection in MySQL workbench, and the fetching problem for me was resloved.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jan 16, 2022 at 0:04
0

I did have this problem today, the reason is:

Error Code: 1356 View 'test.xyz' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

After dropping those view (actually those views) the error was solved.

enter image description here

currently working with MySQL Workbench 8.0.28, and MySQL 8.0.28.

0

See YouTube video: MySQL 8 - The message "Tables Could Not Be Fetched" https://www.youtube.com/watch?v=phi6o8B7kKI

Either a table or view or function used in code has been dropped; hence the "...could not be fetched".

0

this works for me

sudo mysql_upgrade --force

0

As @Brittany Layne Rapheal says, with that command you can fix the issue, is also recommended to give execution privileges to that file:

So you should run first this command:

sudo chmod +x /Applications/XAMPP/xamppfiles/bin/mysql_upgrade

And then, this:

sudo /Applications/XAMPP/xamppfiles/bin/mysql_upgrade --force

--force is necessary because as the parameter says to force the update (Necessary)

0

If you have create view table earlier and than renamed the table or any columns than you also have to change the name manually in view

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Mar 7 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.