I am trying to run a script to import data into MySQL. When I tried, this error shown up. I have searched for a workaround but none is helping. I deleted all the related .cnf file in the said path after a few attempts on trying to run the script but it kept on creating a new one. I have no other means of importing the data besides running that script. Terribly sorry if I somehow really ask a silly question about this but I am new with SQL, stuck and need help on the matter. Thanks in advance.
i have the same error as you, I've manage to solve it on my end by following these steps:
Rather than doing "run sql script", do "open sql script"
After the script open, Execute all (the lightning btn beside the save icon)
Hope this will work for you too!
I ran into this problem as well and, like #Alexandre-St-Amant, the size of my script prohibited opening the script as #vika suggests.
Before noticing #Kwaadpepper's suggestion, I tried using connecting to my database through mysqlsh.exe, then used SOURCE <data_file>. This has the added benefit of allowing linked scripts using SOURCE, solving #Adrian-Moldovan's issue.
Of course, this does not use mysql-workbench to solve the problem.
I had same problem with my sql script.
You may try reinstall the client and workbench. You should follow one version of applications. After that actions my script has worked.
My sql file was really big and I was not able to copy the contents or load the file. Instead, do this :
Server' -> 'Data Import
Dump the data from sql file from here. This worked for me.
I copy and pasted a value out of a SQL table and into the editor window, I didn't realize this string had some strange values in it, it looks like this:
I can't get rid of it now without crashing MySQL Workbench. Every time I try to edit it or delete the string I get the MacOS spinner and finally the system runs out of application memory and I have to force quit the application.
I tried deleting the cache file associated with this DB connection but it did not fix the problem. Any ideas how I can fix this?
Thanks
In order to get rid of that editor content simply remove the saved workspace. Open the log folder, via the Help menu, and go up one level. You will find a workspace folder which contains subfolders, one for each connection. Remove the one that causes trouble (keep Workbench closed while doing that).
Recently, By mistake i closed mysql workbench tab in which i have written half stored procedure, and i did not saved it, so is there anyway to reopen unsaved closed tab or recover whatever i have written in that tab. your suggestions appreciated. thanks in advance.
You may find your unsaved work in %appdata%\MySQL\Workbench\sql_workspaces\ or perhaps %appdata%\MySQL\Workbench\sql_history\. I hope this helps!
If you use Mac, you probably will find it in ~/Library/Application Support/MySQL/Workbench/sql_history.
To get what you really want, you will need to replace somethings like " by " or
by <space>
For window user:
Go to location to get the log file:
C:\Users{userName}\AppData\Roaming\MySQL\Workbench\log
If the file is not present in above location then follow below steps:
a. Open your workbench.
b. go to help->Show log file
c. Find the variable name: "APPDATA". You will get the location of Mysql file
e. Open the path. Then inside that go to "\MySQL\Workbench\log"
Sort the logs based on date.
Open the first one. It contains all the executed commands.
MySQL Workbench regularly saves open editors (if the associated option is set in the preferences) and when you reopen your connection it will bring back all the editors and their content. However, this does not happen for all editors you ever had open. Once you close an editor (before closing the connection) there is no trace left of its content, unless you were editing a file, in which case the original file still exists of course.
I'm getting unable to resolve table errors appear in php files containing SQL querying valid tables.
If I Ctrl + Enter over the query, then I get expected results in the DB console, and if I expand the database in the DB explorer tab then I can see the tables.
It's not affecting code execution, but it's annoying because it catches my eye when writing code, and it masks real SQL errors.
I've tried refreshing the database connection, and I've verified that the php tab is connecting to the correct database.
In 2017.2 I had to go to
Settings > Languages & Frameworks > SQL Resolution Scopes
and add my project and database link in there to get it right again.
Try re-creating DB connection from scratch (delete existing one and create it again).
Thinking of possible reasons ... I can think of this scenario:
working with project in current stable version (currently 2016.1.x);
trying EAP build for next version (2016.2 at this moment) on this project and make some DB-related changes there (even simple syncing DB);
going back to stable version (2016.1.x) .. and because new version uses newer file format/versioning for DB-related data (cached DB structure etc) IDE may start ignoring "unknown/newer" format for such data and instead of throwing appropriate warning it just "silently" throwing "unresolved table" message.
No other ideas.
I was getting what OP was getting, and the problem was my DB Server was MariaDB and i had MySQL selected as the SQL Dialect.
See File > Settings: Languages & Frameworks > SQL Dialects.
Faulty error pollution DRIVES ME NUTS TOO!
If I start having SQL resolution issues, I will check my resolution scopes (settings -> Languages & Frameworks -> SQL Resolution Scopes).
Generally I have the most issues when my project mapping is set to 'All Data Sources' by default.
The following steps always fixes it for me:
Click the Project Mapping Dropdown
Uncheck the global 'All Data Sources' setting (required to make other selection available)
Click the drop down arrow for your Database connection
Check 'All Schemas' (Or Specific Tables)
Click OK to close the settings window
Your false resolution errors should disappear after the next parse cycle.
You aren't limited to applying the above steps to just one DB connection, you can do it for all connections in your project.
Sometimes adding a custom resolution scope will work as well, but it is hit or miss for me.
Click the plus sign (top right)
Select the file you are working on and hit 'OK'
Select the 'Resolution Scope' column
Deselect 'all data sources'
Select the specific DB resources you want
Reconnecting to the DB never works for me.
Specifying the table works well... but it can become very cumbersome as the project grows.
I have also run into an additional situation where PHPStorm would only resolve some of my queries, no matter what scope resolution settings I used. However, after I attached a console to my file, they resolved just fine.
(Search for 'Attach Console' in Help | Find Action. You can also add it to a 'Quick List' or Keymap it.)
Although this answer is specifically for phpstorm, I had this same issue in IntelliJ and none of the above fixes worked for me. I had my scope added, everything was active. I could query the database in the console window perfectly fine, and I was totally stumped.
Eventually, I noticed some text in the database panel that said 0 of 4 in tiny text. It looked like this:
Upon clicking on the 0 of 4 text, I discovered there were no schemas added to the connection, even though a default database was set upon making the connection originally. Going to that page allows you to add schemas. Be sure to either select "All schemas", "Current schema", or the specific database that you want to use with your connection.
Changed dialect to MariaDB on global and project level.
OR
To dismiss this error in PHPStorm versions before 2017 which have no SQL Resolution Scopes option:
Go to File
Go to Settings...
Go to Editor and then Inspections
In SQL chapter uncheck Unresolved reference
Click Apply and then OK
Adding database name before the table name worked in my case.
For instance, instead of writing SELECT * FROM Client, put SELECT * FROM database.Client.
I will add another answer, because for me, it was a completely different (embarrassing) cause:
I somehow forgot to add the database name in the data sources general settings (where you also set the host, user and password).
In my case, I have clicked the right button in the SQLScript and change the Dialect to "Generic SQL". It worked for me.
I solved this problem as follows:
CTRL + SHIFT + F10
new query console
Write a selection query to the database, for example:
SELECT * FROM user WHERE user_email='$email' AND user_password='$password'
Enter your code page and click on the table name in the query
ALT + ENTER
run query in console
Select the console you created
First, you need to check the Schemas tab, and make sure you've added the database.
If the unable to resolve table error stills appears, there're two options to fix this:
1.You can edit the properties of the Data Source and add the name of Database, then you can see that select * from table works well.
2.On the other hand, you can also use sql like this select * from database.table. It works for me.
By the way, in many situations, autocomplete can be very useful.
[PHPSTORM]I solved this problem by setting
Languages&Features
SQL Dialect
adding your current file into path and modify its SQL Dialect as a server you are using.
NOTICE!!!!! mine is MySQL but it is exactly MySQL causing problems, after switching into [generic SQL] PROBLEM SOLVED!!!
I am a beginner attempting to learn SQL with Zed Shaw's "How to Learn SQL the Hard Way"
In excercise 0: The Set up, he states:
Then, look to see that the test.db file is there. If that works then you're all set.
But when I run the command,
sqlite> create table test (id);
sqlite> .quit
the execution runs, but it doesn't create a test.db file. I looked in the same folder as where the sqlite3.exe file is and I see nothing.
I attempt to see if I can continue without this step, then - In his next exercise, "Excercise 1: Creating Tables":
I input his commands, but when attempting to run sqlite3 ex1.db < ex1.sql, it gives me an error.
I even tried putting the create table command and saving it as a '.sql' file into the same folder as sqlite3.exe.
How can I set this environment up properly? Can someone explain this on an "easy to grasp" level? Any response is appreciated**
Edit 1
I'm not exactly sure how Zed Shaw how he wants his learners to use SQLite 3, Maybe I can go into some research but I just don't understand why he leaves such a large gap of assumption that everyone knows what to do for the set up process...
I had this exact problem. I am using windows 7.
From this website: http://www.sqlite.org/download.html
I used the:
"sqlite-tools-win32-x86-3130000.zip
(1.51 MiB) A bundle of command-line tools for managing SQLite..."
under the "Precompiled Binaries for Windows" heading.
My helper directed me to open the file named "sqlite3" after I'd extracted the files from the zip file. It brought up a black window, in the command line style, showing some text, and then the familiar sqlite> prompt.
Then he had me input:" .save data_base_name.db " (I chose to have my database be named 'thedatabase'.)
which created a file in the same folder as the sqlite3 file, called "data_base_name" as a "Data Base File".
That's where I'm at so far, I'll post updates as I have them.