Osquery how to run select command? - osquery

I installed osquery on my Kali Linux 2019.3 (VirtualBox VM) via using this link: https://osquery.io/downloads/official/4.3.0 (I picked debian)
I tried to run select comond, nothing happens. Only apperas ...>
For example when I tried select* from listening_port againg nothing happens. How can I solve this?

I found the my mistake, I forgat use ";" after code. For example it must be select * from listening_ports;

Related

#1558 - Column count of mysql.proc is wrong. Expected 21, found 20. Please use mysql_upgrade to fix this error

I got this message when I try to run query on XAMPP in macOS
#1558 - Column count of mysql.proc is wrong. Expected 21, found 20. Created with MariaDB 100108, now running 100421. Please use mysql_upgrade to fix this error
I tried to write
'mysql_upgrade -u root -p'
on my terminal but I got this message
zsh: command not found: mysql_upgrade
I also ran into same issue and after cracking my head for the past 10hrs, I finally realise how to perform the upgrade. U
go to your Mac terminal and paste the following code:
Applications/XAMPP/xamppfiles/bin/mysql_upgrade -u root -p
Supply your root password and see it work like magic.
Contrary to what many people posted online by using /opt/lampp/bin
It always gives a zsh not found error.
I hope this helps you and in the future for others who might need it.
You could try switching to a different shell, say bash by typing bash in your terminal.
Then proceed to run mysql_upgrade normally in the appropriate directory
I also could not run the code from the Terminal. I was, however, able to go to the folder itself and "run" the mysql_upgrade application. If you are using XAMPP and the Application Manager, there's a button to Open Application Folder. If you click that, finder will open where XAMPP lives. Open the bin folder. Then scroll until you find mysql_upgrade. Double click it. It will run in a Terminal session and complete the upgrade. Hope this helps someone else as I spent waaayyyy too much time trying to get this to work.

Issue with Postgres on windows 10

I have installed PostgreSQL 13 on windows 10
When I tried to run this command:
$ which Postgres on Git Bash, It returns which: no Postgres in (/c/Users*ahmedeid/......
Could you help me solve the issue?
It seems that your PostgreSQL installation's bin directory is not on the PATH, so you cannot find the server executable.
You'll have to modify the PATH environment variable appropriately.
Another possibility is that your bash was already running when you installed PostgreSQL, so that its PATH setting is out of date. Try closing bash and start a new one. Maybe that one has the correct setting.

SQLDeveloper not starting

When i try to start SQLDeveloper, it is giving me the following error in command prompt:
Error: This product requires a Java(TM) Platform 5.0 runtime.
You are using 1.4.2-b28 from C:\j2sdk1.4.2\jre
But my JAVA_HOME is set to java 6
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_32
Can anyone explain what exactly to do to resolve this?
Oracle SQL Developer uses a configuration file named products.conf which is situated at your roaming directory.
If you are using Windows 7 then the directory path will be:
C:\Users\\AppData\Roaming\sqldeveloper\1.0.0.0.0
Delete whole sqldeveloper directory from C:\Users\\AppData\Roaming\
Re run sqldeveloper executable, this will prompt for jdk home
Select jdk home. i.e C:\Program Files\Java\jdk1.7.0_55
Enjoy!
In my case i had 2 folders under C:\Users\username\AppData\Roaming\
sqldeveloper
SQL developer
after removing both of them and launching installation dir\sqldeveloper\sqldeveloper\bin\sqldeveloper64.exe it worked.
True acknowledgement / attribution belongs to Vishal at the following URL:
http://vishalorcl.blogspot.com/2012/12/sql-developer-from-11201-client-software.html. It describes in detail how to resolve this problem. From the page:
I am running Oracle 11g version of SQLDeveloper. I have same problem
noted above, after fresh install of Oracle. The summary is that
SQLDeveloper seems to require the Java 32-bit JDK.
Install 32-bit jdk V7 from Oracle:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
There is a sqldeveloper.conf file located in
C:\app\UserName\product\11.2.0\dbhome_1\sqldeveloper\sqldeveloper\bin
In the file change pathname within the line at end of file:
SetJavaHome C:\app\admin\product\11.2.0\client_1\jdk
To point to pathname of the jdk install directory; also sometimes
known as JAVA_HOME.
I had this problem too!
you should go to: C:\Users-your user name-\AppData\Roaming\sqldeveloper-version of your sql developer-
there is a file named product.conf there. Right click on it and edit it with notepad in the document change the address of java home and save it.
Done!
In my case, none of the other suggestions worked. Instead, I moved the installation directory from
c:\sqldeveloper
to
anything else
And things worked again. Perhaps, some Windows registry value got broken in an unfixable way...
I don't think SQLDeveloper uses the environment variable. There should be a .conf file that contains a reference to the JDK directory.
I solved this by deleting the folder /home/USERNAME/.sqldeveloper
After that, I started SQLDeveloper and without typing anything, it found the right java-version and started without complaining :-)
So, if you don't want to delete the whole folder, maybe search there for the file which defines the java-version :-)
edit: just found that:
"Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path
will be stored in ~/.sqldeveloper/jdk"
check the version of java that you are installing to you Pc the error show that you are using 4 so uninstall the java that you have then install a new one that is version higher than 5
Removing the instances from the registry worked for me.

The local psql command could not be located

I'm following the instructions found here.
When I try to run $ heroku pg:psql or $ heroku pg:psql HEROKU POSTGRESQL_BROWN I recieve the following error message:
! The local psql command could not be located ! For help
installing psql, see local-postgresql
I can't find anything useful on the link it gives me (it just links to the instructions I was already using, but further down the page) nor can I find this error anywhere else.
If I've missed anything you need to know to answer this, just let me know. I'm rather new to all this and teaching myself as I go.
I had same error even after installing Postgres locally.
But after seeing this
I saw that "pqsl" was not in the PATH so I then did
PATH=%PATH%;C:\Program Files\PostgreSQL\9.2\bin
which worked for me
I have since solved this myself. When I ran heroku pg:info it says the version number is 9.1.8, I was locally running 9.2
installing 9.1.8 and ensuring Path pointed to the appropriate folder solved the problem.
After you change the path, make sure to restart the terminal!
Set the PATH. To find out the PATH of your psql script (on mac) open the sql shell script from your finder in Applications/Postgres installation. This will give you a hint as to where it is installed. That opened a window which told me it is located here: /Library/PostgreSQL/8.4/scripts/runpsql.sh
Then, I set the PATH variable from the terminal window by typing:
$ PATH="/Library/PostgreSQL/8.4/bin:$PATH"
(depends on the location of your PostgreSQL installation, find your bin path first, another exp: /usr/local/Cellar/postgresql#9.6/9.6.8/bin)
OR.....
You can also connect to the shell by opening the shell directly from your postgres installation folder. Then enter the credentials. If you don't know the credentials, here is how to find them out:
$ heroku pg:info
=== HEROKU_POSTGRESQL_RED_URL (DATABASE_URL)
$ heroku pg:credentials HEROKU_POSTGRESQL_RED_URL
Top answer wouldn't work for me oddly, my system would not add the Path via cmd with administrator access (Not sure why).
So check this > Windows key > environment variables > system variables
And add the last line (your version may differ in the path)
Make sure you've installed the toolbelt as psql is installed by default.
However you also need to ensure you've installed a local copy of PostgreSQL; if you don't the toolbelt will be unable to find the native psql client.
Assuming you have installed a local copy of PostgreSQL, make sure you can execute psql from the command line directly (i.e make sure you PATH is set correctly ). If the command does not execute, check your PATH, if it does execute see if you can connect via the PSQL connection string provided in the Heroku control panel. If you can connect reinstall the toolbelt, if you are unable to connect provision another dev database and try again.
If there are still issues, I would suggest contacting Heroku support for assistance after verifying no API issues are listed on the status page located here.
I got rid if this annoying message on Windows by adding a path element without the spaces, i.e.
C:\Progra~1\PostgreSQL\9.4\data
instead of
“C:\Program Files\PostgreSQL\9.4\data”
I followed the instructions here: http://www.computerhope.com/issues/ch000549.htm, which worked for me if you prefer to go the point-and-click configuration of the PATH variable.
This type of error usually appears in the Windows environment, because if you do not update the PATH after installing Postgresql, heroku pg:psql command does not work.
So you need to update your PATH environment variable to add the bin directory of your Postgres installation. The directory will look like this:
C:\Program Files\PostgreSQL\<VERSION>\bin.
For more information, go to the Heroku in Local setup website:
heroku-postgresql: Local setup
I had the same problem and discovered that Heroku doesn't seem to provision the latest version of PostgreSQL by default. Where the Heroku Getting Started instructions said
heroku addons:create heroku-postgresql:hobby-dev
That provisioned a v10 database for some reason (which you can check by clicking on Heroku Postgres in the Add-ons tab of your dashboard). I deleted that database and provisioned a new database using the --version flag:
heroku addons:create heroku-postgresql:hobby-dev --version 11
As of now, at least, you can find the latest version of Postgres supported by Heroku at this link: https://devcenter.heroku.com/articles/heroku-postgresql#version-support-and-legacy-infrastructure
I'm writing this in early 2019, but according to the PostgreSQL website the next version (12) is "tentatively scheduled" for third quarter of 2019 so if you're reading this in late 2019 potentially the same problem will come up for v12 instead
On Mac you can use the following:
export PATH="/Library/PostgreSQL/12/bin/:$PATH"
The only solution that I found on Windows:
go to advanced system settings
go to environment variables
select Path variable and click Edit
add a new line and enter your bin directory path (C:\Program Files\PostgreSQL<version>\bin) and click ok
restart your terminal
enter your psql command (heroku pg:psql)

Postgres error "invalid value for parameter "TimeZone": "UTC""

Jupitor$ bundle exec rake db:create db:migrate
APP_development already exists
rake aborted!
PG::Error: ERROR: invalid value for parameter "TimeZone": "UTC"
: SET time zone 'UTC'
I keep getting this error when trying to migrate to my postgres database.
help would be much appreciated!
I had the same problem using the Postgres.app from Heroku. Rebooting my Mac solved it.
Restarting postgresql works.
To restart if you've installed it using homebrew, brew info postgresql will tell you to:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
brew services restart postgresql
Try restarting the server. I updated Postgresql through Homebrew but forgot to restart the server and got this same problem. I believe it's due to the client and server versions not matching. psql started with:
$ psql
psql (9.1.4, server 9.1.2)
Type "help" for help.
Based on #MathiasJ's answer, instead of rebooting my entire machine, I ran
brew services restart postgresql#9.6
and my subsequent rake db:create worked perfectly.
I don't think I deserve any points for that but rebooting my Postgres.app (which is better than rebooting the whole system) solved it for me. The app doesn't show up on the Dock, you can find it on the navbar at the top of your window. Hope it helps anyway.
What actually happened is that you upgraded the postgresql server and cleaned-up your old folders but you haven't restarted your postgresql server. The server searched for the timezones files in the deleted dir
If nothing else fixes and you happen to be using homebrew, chances are you have issues with current links.
Assuming you have two Postgres versions installed, make sure you unlink and then link again. In my case, I needed the two versions working in order to run pg_upgrade. I have postgresql95 and postgresql so I did:
$ brew unlink postgresql
$ brew unlink postgresql95
$ brew link postgresql95
$ brew link --overwrite postgresql
That got me both working at same time. Hope it becomes helpful as it took me a good while to figure that out!
I also had this problem.
Login to the database then issue:
set time zone utc;
In my case restarting the database didn't help. Updating tzdata (apt-get install tzdata) did the trick for me.
just restarting the database helped. Homebrew updated my Postgres installation and I did not restart yet.
I had a similar problem after updating time zone information, that is, downloading the IANA database and compiling using zic.
My problem actually began after restarting PostgreSQL. I got invalid value for parameter TimeZone: UTC and restarting again did nothing to solve the problem.
It turns out my time zone information was completely messed up after the update. I had dangling symbolic links in /usr/share/zoneinfo. From a psql console, I got:
mydb=# SELECT * FROM pg_timezone_names;
ERROR: could not stat "/usr/share/zoneinfo/PRC": No such file or directory
I deleted all such dangling symlinks. After doing this, at least I could get SELECT * FROM pg_timezone_names to work, but still got the same invalid value... error.
What finally solved the problem for me was creating a new symlink:
cd /usr/share/zoneinfo
ln -s Etc/UTC UTC
After this, SET time zone 'UTC' worked correctly.
brew services restart postgresql did not fix for me. I'm sure rebooting would've worked, but I wanted to figure out the cause of the issue.
I believe the issue was caused for me because of two conflicting versions of postgresql.
I already had postgresql running with brew services, and then installed postgresql#11 which left postgresql running in brew services even after I uninstalled postgresql.
I fixed this by stopping the postgresql brew service, even though it wasn't listed in brew services list.
Steps to reproduce:
$ brew install postgresql
$ brew services start postgresql
$ brew install postgresql#11
$ brew uninstall postgresql
$ brew services start postgresql#11
How to fix:
$ brew services stop postgresql
Update: issue appears to have been deleted.
Opened an issue on Homebrew requesting that a formula's service should automatically be stopped upon uninstall.
Just a quick reference for those that are not using Postgres.app, but that start psql from the command line or through launchctl. You'll need to adjust the following for where you have your Postgres data and log files located at:
pg_ctl stop
pg_ctl start -D /usr/local/pgsql/data/ -l /usr/local/pgsql/log/server.log
For everyone using homebrew.
brew services restart postgresql did not fix for me too.
Rebooting fixed the issue. Thank you #JBallin, what you said is right.
Apparently, a similar thing also happens with Java/JDBC while connecting to Postgres.
The solution there is to tell JDBC to report the correct user timezone to Postgres while getting the connection.
So, explicitly mention the user timezone while starting the program helps:
java -Duser.timezone=America/Los_Angeles com.example.MyMainClass
Note:
Adding this here because this happens to be the first result on Google for this issue with connecting to Postgres!
Source:
This comment by Yuriy on the Jira support forum:
https://community.atlassian.com/t5/Jira-questions/invalid-value-for-parameter-quot-TimeZone-quot-quot-US-Pacific/qaq-p/839426