In this tutorial I will show you how to setup database connection and SQL dialect on PhpStorm. You will explore the Database panel and SQL Dialects settings.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# PhpStorm Setup database connection + SQL dialect # MySQL Workbench # PhpStorm # Open share/mysqldump/mysqldump-01.sql # No data sources are configured to run this SQL and provide advanced code assistance. # SQL dialect is not configured. MySQL matches best. # Show "Tool Buttons" View / Tool Buttons # Access "Database" panel "Database" button View / Tool Windows / Database # Configuration for an SSH config file vagrant ssh-config New / Data Source / MySQL Name: http.liviubalan.com General Host: localhost User: usrmysql (see provision-shell/resources/var.sh) Password: pwd-mysql-usrmysql SSH/SSL Use SSH tunnel: checked Proxy host: http.liviubalan.com Proxy user: vagrant Auth type: Key pair (OpenSSH) Private key file: /liviu-doc/vagrant/liviubalan.com-vagrant-ubuntu/.vagrant/machines/liviubalan.com-VM/virtualbox/private_key Download missing driver files Database / Right Click on "http.liviubalan.com" / Properties Schemas check db1.*; Resolve unqualified references: checked check db2.* check wordpress.* Database / Synchronize # Resolve unqualified references # To be able to reference the tables by their "short" names (e.g. in the database console or in your SQL files), # select the corresponding check boxes. Otherwise, only fully qualified table names will be treated by PhpStorm # as valid. # Note that the DBMS may reject short names when you execute the corresponding statement or statements. Database / Right Click on "http.liviubalan.com" / Open Console # Look at autocomplete tables database # Change "db2.* Resolve unqualified references: checked" and reload the process SELECT * FROM # See "SQL dialect is not configured. MySQL matches best." # If no dialect is specified basic SQL92-based coding assistance is provided File / Settings... Search for "dialect" Languages & Frameworks SQL Dialects Project root: MySQL # Reopen share/mysqldump/mysqldump-01.sql # PhpStorm Database driver path "Database" button / Data source Properties / MySQL # Even if you remove it from PhpStorm the file will remain into the file system Select "/home/liviu.balan/.WebIde100/config/jdbc-drivers/mysql-connector-license.txt" / Remove / Apply # CLI cd ~/.WebIde100/config/jdbc-drivers/ ls -al # Useful links https://github.com/liviubalan/liviubalan.com-vagrant-ubuntu https://www.youtube.com/watch?v=kjPbxVlPnSI https://www.vagrantup.com/docs/cli/ssh_config.html https://www.jetbrains.com/help/phpstorm/2016.1/data-sources-and-drivers-dialog.html?origin=old_help https://www.jetbrains.com/help/phpstorm/2016.1/sql-dialects.html?origin=old_help |
Useful links:
https://github.com/liviubalan/liviubalan.com-vagrant-ubuntu
https://www.youtube.com/watch?v=kjPbxVlPnSI
https://www.vagrantup.com/docs/cli/ssh_config.html
https://www.jetbrains.com/help/phpstorm/2016.1/data-sources-and-drivers-dialog.html?origin=old_help
https://www.jetbrains.com/help/phpstorm/2016.1/sql-dialects.html?origin=old_help