database relationship line isn't show on datadrip and phpmyadim - mysql

I'm developing an app and a draw the entire database( relationship, set forein keys and so on), I'm using mysql as databas server, until here it all ok, but when trying to visualize the database the relationships lines is not showing, all I see is the tables but about the reference keys for relationship seems all good, please I would like that you guys help me to fix it.
I'm posting the database image from datagrip

thanks all for the helps, i'm using wamp server and for same unkwon reason for me it's set engine=MYISAM as default engine default and after ready this issue https://www.siteground.com/kb/how_to_change_the_database_engine_of_a_mysql_database_table/
i was looking a way to fix it and i did the following steps on wampserver:
1 º left click on wampserver icon > mysql > my.in (click on that)
2 º on my.in > ctrl+l > paste this on input field : default-storage-engine=MYISAM > press enter
3 º if find changes it's value to default-storage-engine=innodb
4 º save the my.in file and enjoy,
i hope it can help others ........
down i'm posting the images to see that is all okay now for me
enter image description here
enter image description here

Related

MYSQL codes not being read

When I input a code or anything into MySQL and hit "enter" it moves down and "->" appears. It is as if the code is not going through or the code is not being read.
I have attempted to download "add-ons" but I am really not sure what I am doing. This is for school and I am having trouble getting in touch with the professor.
I am new to this and can't figure out what I am doing wrong. Please help!
Please see image of what it looks like to me.
Please add semicolon ; after the mysql code.
Problem 1: Be aware of the prompt. Either of these
MariaDB >
mysql >
means that you are inside the MySQL commandline tool. You can enter only SQL statements. Most SQL queries need to be terminated by a ; or \G (but not both). To exit that tool:
exit
Or, if you get stuck in certain ways
CTRL-C
exit
Each of these implies a shell script:
$
#
mymachine$
/usr/home/rj $
C:\Users\rj:
and many others
Problem 2: mysqldump is a command, not SQL. So it needs to be executed in a shell script.
Problem 3: There is yet another problem. When it suggested typing 'help;', it did not mean for you to include the quotes. Instead, type just help;.

No SQL option on Export of a table in PHPMyAdmin

PHPMyAdmin is showing some strange results when I go to export a table as SQL. If I go to the main database and select Export (i.e. the whole database) at the top it works as expected but when I go to a table and try end export just that table, there is no SQL option in the select list on the "Format:" section.
I am using Server version: 5.5.62(MySQL) and phpmyadmin 4.8.4. This is server wide (happening on all db's on this server)
There is a workaround, I can go to the main database level and export all and only tick the options of the tables I want but want to get this to work.
I have read about a max_input_vars setting but if this was the case, it would not export the whole DB, this just happens at a table level.
Thanks in advance
The fix does work, have applied it to many servers at this point.
Fix # 14775 : edit 'Export.php'
Resolution:
Connect to the server via SSH.
Open file:
/usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/classes/Display/Export.php with a text editor.
Note: for Windows, it will be
%plesk_dir%admin\htdocs\domains\databases\phpMyAdmin\libraries\classes\Display\Export.php.
Find line /* Scan for plugins */
Add the following above the line:
// Export a single table
if (isset($_GET['single_table'])) {
$GLOBALS['single_table'] = $_GET['single_table'];
}
This is caused by a bug in version 4.8.4 of phpmyadmin. ppmyadmin team are working on it in this github issue.
There seems to a workaround available (I did not test it myself) : if I select the db, then checkbox the table(s), exporting under "with selected" I get the SQL option.
I am using xampp in ubuntu locally and I don't have /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/classes/Display/Export.php file. SO I searched about this file and I found it here: /opt/lampp/phpmyadmin/libraries/classes/Display/Export.php
After editing this file from the
// Export a single table
if (isset($_GET['single_table'])) {
$GLOBALS['single_table'] = $_GET['single_table'];
}
(as the first answer) resolved my problem.

phpMyAdmin - how to save a SPATIAL Point

I'm trying to store a Spatial Point in a dataBase in phpMyAdmin and I don't know why is always shown like [GEOMETRY-25B]. Below is the command I use.
INSERT INTO `locations`(`Location`) VALUES (GeomFromText( 'POINT(40 -100)'))
or
INSERT INTO `locations`(`Location`) VALUES (Point(40,-100))
Click on Options, then select "Full text" and "Well Known Text".
I found something. The points are stored ok and if you try to execute the query below it returns the points as POINT(4 5) for example. But how can I make them visible to the table?
SELECT AsText(`Location`) FROM `products`
Update:
As #Marc mentioned above, after the upgrade of phpMyAdmin to the latest version 4.0.7 there is an Option "Well Known Text" which makes points visible to the table.

Pasting SQL into the MySQL command line

I have an application that is defining some SQL code:
mySql = "SELECT
sq.question,
qs.title,
sq.id as question_id,
sq.type,
qs.id as option_id,
sri.title as rankTitle,
sri.id as rankId,
sfi.title as formTitle,
sfi.id as formId,
sq.sub_type,
sq.sort_order
FROM survey_questions as sq
LEFT JOIN question_suboptions as qs
ON sq.id = qs.question_id
LEFT JOIN survey_rankingitems as sri
ON sq.id = sri.question_id
LEFT JOIN survey_formitems as sfi
ON sq.id = sfi.question_id
WHERE sq.survey_id = #{#surveyId}
ORDER BY sq.sort_order"
I would like to paste this code (everything between the double quotes) in the MySQL command line, change the one parameter and execute it, but I have run into an issue where for every line above MySQL will display:
Display all 1450 possibilities? (y or n)
And then 1450 different available commands. If I remove all linebreaks and tabs then I can paste in, but that is time consuming and a pain. Is there a way that I can simply paste in the above code, edit it and then execute it as a single unit?
This is the default mysql (CLI) behavior each time the user presses the Tab key (mysql uses the underlying readline or EditLine libraries (not on Windows)).
By default, when the user requests to use a database, mysql reads tables and fields definitions. Then, pressing the Tab key makes mysql conveniently offers completion of the current input with the known tables and fields.
However, pasting some text into mysql that contains TAB characters (\t or 0x09) triggers the same behavior - even though no Tab key was actually pressed from the keyboard. And this can be annoying.
Two options given to mysql can prevent that behavior, though. My favorite is --disable-auto-rehash. The other one is --quiet or -q.
--disable-auto-rehash to prevent database, table, and column name completion (which are not read from the database, use the rehash command if later on you need completion). Commands history is kept, though (retrieved via the ↑ and ↓ keys for instance). Which is convenient.
--quick or -q which makes mysql not using the history file and no completion (does not read the database definitions).
On Linux one may add an alias in .bashrc to use --disable-auto-rehash automatically
alias mysql2='mysql --disable-auto-rehash'
Perhaps you could save the statement to a text file myTest.sql, then use the MySQL command source myTest.sql to run it? You could then tweak the SQL in the file, save the changes, and run it again.
You need to remove the line breaks and tabs. The double tab is causing it to display the Display all 1450 possibilities? (y or n) and the line breaks are causing it to execute early.
If it's PHP, write a little script to strip it for you:
echo (preg_replace("/\s+/", " ", $string));
Or something similar for other languages.
Breaking not so bad's answer explained the cause of this problem really well.
From the question:
If I remove all linebreaks and tabs then I can paste in, but that is time consuming and a pain.
In my case, I just replaced the tabs with spaces and I was able to paste the query just fine. The MySQL console doesn't seem to care about the newlines, just the tabs.
As a way to prevent this, most editors have a setting that will insert tabs instead of spaces when you press the Tab key. I normally have my IDEs configured this way, but in this instance it was a query I'd copied from MySQL workbench. Conveniently, it also has a setting to use spaces instead of tabs:
Edit > Preferences > General Editors > check Tab key inserts spaces instead of tabs > OK

Insert LargeBlog sql issue

Right I seem to be having a issue inserting a image into a database (don't ask why lol)
If tryed a simple
UPDATE player SET Image = load_file('94.jpg') WHERE id =94;
And had the image directly located from where im running the sql commands from
UPDATE player
SET Image = load_file('C:\Users\***\Documents\databases\Scripts\94.jpg')
WHERE id =94;
I have also tried the above with the full path but when i query the table it shows the Image column of type LargeBlog as empty!
Any ideas????
The file must be on the machine MySQL is installed on.
I have managed to fix it with the use of forward slashes instead of back slashes. So im getting it into the database now... all goood
but i want to do relative paths and as i said ('94.jpg') doesn't work. When its placed my C:\Wamp directory... Which is the same place I put sql scripts when I run them with a simple
source script.sql; <-Notice no path required and it works. So I assumed that MySql default directory was the Wamp Folder