5

There are some related posts to this but I still can't figure this out. I have a working install of XAMPP(latest version) and MySQL Workbench 8.0.17 installed. I just want to be able to use Workbench with the MySQL that ships with the XAMPP install.

In the latest version of XAMPP, it first sets an IP address before I can start apache and mysql. MySQL seems to be running on port 3307.

Here is the Workbench screen to make a new connection. XAMPP is running on localhost - should that be my hostname?

enter image description here

If I try a localhost or 127.0.0.1 hostname with port 3307 (where I think XAMPP's MySQL is) I get this popup alert. If I continue, I still don't see any of my databases listed on the main screen.

enter image description here

Kinglish
  • 23,358
  • 3
  • 22
  • 43
  • 1
    MySQL is normally on 3306 – RiggsFolly Sep 03 '19 at 15:42
  • 1
    Those defaults look like they should work as they are – RiggsFolly Sep 03 '19 at 15:53
  • your error message looks like your xampp is shipped with an older version of mysql. So the connection is established but mysql is not at least 5.6 – Lelio Faieta Sep 03 '19 at 15:57
  • This always happens. After I post a question I figure out something important. XAMPP ships with MariaDB which MySQL Workbench doesn't support. I am going to attempt to revert XAMPP to MySQL (not MariaDB) - (@RiggsFolly - XAMPP appears to utilize 3307 for the DB) – Kinglish Sep 03 '19 at 15:57
  • For mariaDB, maybe they did so you can install MySQL and us it on 3306 without conflicts – RiggsFolly Sep 03 '19 at 16:03
  • @RiggsFolly - If I have MySQL running on port 3306 - how do I tell XAMPP to use that MySQL install? DO I just edit the my.cnf that XAMPP uses to point to the mysql install? – Kinglish Sep 03 '19 at 16:06
  • Does this answer your question? [Tables could not be fetched - Error loading schema content](https://stackoverflow.com/questions/56564410/tables-could-not-be-fetched-error-loading-schema-content) – Deepam Gupta Feb 08 '21 at 03:21

5 Answers5

23

This is the way I have used to connecting MySQL workbench to Xampp MySQL.

01) Click on the Plus icon.

Click on plus icon

02) Check the Xampp MySQL port number.

Check the Xampp MySQL port number

03)Type the connection name and check the port number with your Xampp MySql port number.

Type the connection name and check the port number with your Xampp MySql port number

04) Click on the "Continue Anyway" button.

 Click on the "Continue Anyway" button

05) Then click on the "OK" button to save the connection.

Then click on the "OK" button to save the connection

06) Now you can see the connection you just created and click on it to connect to the MySQL database.

Click the newly created connection

07) Just try to run some SQL code to if properly connected to Xampp Mysql.

Just try to run some SQL code

Prasad Gayan
  • 1,424
  • 17
  • 26
1

I finally find solution on mac:

Notice that XAMPP server works on virtue machine inside with debian system and MoriaDB, so if you'd like to run Mysql WorkBench on MacOS outside, you must not use 127.0.0.1 or localhost as host name.

Please check your ip address of XAMPP on its panel General tab, mainly like 192.xxx.xxx.x, this is your host name!

And if you disable or uninstall mysql in your system, you can safely use default port 3306, or if you must use both XAMPP and local version, modify one pls.

Then, when it comes to user part, do not use root! Please add a new user in phpMyAdmin with hostname %, or open XAMPP terminal and use mysql instructions.

After filling all those above, Mysql will be able to start (although with warning, you can ignore it).

Sion Gao
  • 11
  • 1
  • This partially solved my problem, but now it turns out MySQL workbench and MariaDB don't get along, so while I'm able to see the DBs, I can't actually do anything with them and get an error "Tables could not be fetched - Error loading schema content". I'll add a new comment if I solve that issue – Robin Oct 03 '22 at 17:09
0

The way I 'fixed' this issue was to install an older version of xampp (5.4x) which ships with mysql, not mariadb. Before the install, I dumped all my dbs into a file and then imported them again after the install. Through XAMPP/phpMyAdmin I could see the fresh database. I tried to connect with MySQL Workbench and walla!

Kinglish
  • 23,358
  • 3
  • 22
  • 43
0

If you are on Ubuntu, run this command on terminal

sudo /opt/lampp/bin/mysql_upgrade

and then follow @prasadgayan 's answer above.

Note: It is a slight chance that your mysql_upgrade be in some other directory. If that's the case, run it from that path.

Please comment, if something similar work for Windows as well.
Namaste

Reference: Tables could not be fetched - Error loading schema content

Deepam Gupta
  • 2,374
  • 1
  • 30
  • 33
0

Normally the issue is that one is trying to use root as a user, which is somewhat prohibited. So just create a new user with the correct access privileges granted. Here's a solution, that worked on a Mac (but should be relevant to most OS's).

Start the XAMPP stack. For simplicity, open phpMyAdmin, by default accessible via 127.0.0.1:80/phpmyadmin/ or 127.0.0.1:80/phpmyadmin/ locally. In case needed, log in with the username root and an empty password field. Create or pick a database for the user, to grant access to, for example "test_db". Enter the following in any SQL prompt (which normally can be executed by pressing [ctrl] + [enter]):

create user userbob identified by 'Pass2bob!';
grant all privileges on test_db.* to userbob@localhost;

Note your Xampp IP-adress which tends to default to "192.168.64.2" and port 3306. Now you should be able to access that database.

I tested the connection with some PHP-code, which I included here and might come handy for someone. 3306 is default as MySQL/Maria the database port, but I left it here in case someone, sometime, have to use a different port.

<?php
$con = mysqli_connect("192.168.64.2","userbob","Pass2bob!","test_db", 3306);
if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); }
?>
K. Kilian Lindberg
  • 2,918
  • 23
  • 30