zsh: command not found: mysql answered - sql

Kept getting this error every time I tried to start SQL on Mac
zsh: command not found: mysql
➜ u-develop-it git:(main) ✗

For zsh: command not found: mysql
GO TO DIRECTORY OF PROJECT
Try:
export PATH="${PATH}:/usr/local/mysql/bin/"
Then enter
mysql -u root -p
you will then be prompted for SQL password
Or All toegther
/usr/local/mysql/bin/mysql -uroot -p

Related

Do you know how to exit of the command not found: uname?

I am a beginer and I was trying to connect postgres to a database ig and this happen and can't exist nor clear
Users/kouadiondah/.oh-my-zsh/oh-my-zsh.sh:56: command not found: mkdir
/Users/kouadiondah/.oh-my-zsh/oh-my-zsh.sh:117: command not found: rm
compdump:136: command not found: mv
detect-clipboard:33: command not found: uname
I can't exit of this
Any help??
same problem here. I think it has to do with the FPATH-Variable but I do not get a solution.
My errors are:
/home/weidner.f/ohmyzsh/oh-my-zsh.sh:56: command not found: mkdir
/home/weidner.f/ohmyzsh/oh-my-zsh.sh:56: command not found: mkdir
/home/weidner.f/ohmyzsh/oh-my-zsh.sh:117: command not found: rm
parse_git_dirty:18: command not found: tail
This messages occur in the terminal when I am opening my IDE (IntelliJ)

running postgresql image with podman failed

When running postgresql alpine image with podman :
podman run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=test -e POSTGRES_USER=test -d postgres:11-alpine
the result is :
Error: /usr/bin/slirp4netns failed: "open(\"/dev/net/tun\"): No such device\nWARNING: Support for sandboxing is experimental\nchild failed(1)\nWARNING: Support for sandboxing is experimental\n"
The running system is archlinux. Is there a way to fix this error or a turn arround ?
Thanks
Is slirp4netns correctly installed? Check the project Site for information.
Sometimes the flag order matters. try -d first and -p last (directly infornt of the image) looking like:
podman run -d --name postgres -e POSTGRES_PASSWORD=test -e POSTGRES_USER=test -p 5432:5432 postgres:11-alpine
Try only creating the neccessary password, then log into your container and create manually (this always worked for me)
podman run -d --name postgres -e POSTGRES_PASSWORD=test -p 5432:5432 postgres:11-alpline
podman exec -it postgres bash
Create default user postgres
su - postgres
start postgres
psql
create databases and tables
CREATE USER testuser WITH PASSWORD 'testpassword' | Doku
CREATE DATABASE testdata WITH OWNER testuser
Check if it worked
\l+
Connect to your Database via IP and Port
I assume you upgraded Arch packages recently. Most likely your system needs a restart.

Can't open lib '/usr/local/lib/libmsodbcsql.17.dylib'

I am trying to get mssql working on my OSX machine. However, it keeps giving me error:
$ sqlcmd -S 0.0.0.0,1401 -U SA -P P#55w0rd -i database-setup/sql/initialize.sql
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Can't open lib '/usr/local/lib/libmsodbcsql.17.dylib' : file not found.
Although, I am pretty sure, my file is in that location:
$ ls -la /usr/local/lib/libmsodbcsql.17.dylib
lrwxr-xr-x 1 localadmin admin 64 7 4 16:38 /usr/local/lib/libmsodbcsql.17.dylib -> /usr/local/Cellar/msodbcsql17/17.1.0.1/lib/libmsodbcsql.17.dylib
$ ls -la /usr/local/Cellar/msodbcsql17/17.1.0.1/lib/libmsodbcsql.17.dylib
-r--r--r-- 1 localadmin admin 2539360 7 4 15:34 /usr/local/Cellar/msodbcsql17/17.1.0.1/lib/libmsodbcsql.17.dylib
I know this question has been asked multiple times but none of the available solutions have worked for me.
Things I have tried:
https://github.com/Microsoft/homebrew-mssql-release/issues/7
https://github.com/Microsoft/homebrew-mssql-release/issues/3
I fixed my problem by:
$ brew uninstall msodbcsql17 mssql-tools
and then:
$ brew install msodbcsql17 mssql-tools
For me this solved it:
brew install microsoft/mssql-release/msodbcsql17

Error in Mysqldump command

I have a data base named "mig". it has 10 tables. now i want to create a same database in another system so I am using mysqldump command but it shows error.
I entered command as follows :
mysqldump -u root -p root mig >file.sql;
This is the error i got :
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
dump -u root -p root mig >file.sql' at line 1
I am getting the same error when I use ,
mysqldump -u root -proot mig >file.sql;
How can i fix this ?
Simply try-
mysqldump -u root mig> file.sql
Edit
mysqldump is not a MySQL command, it is a command line utility. You must call it from your shell command line. I hope you are not calling this from MySQL prompt.
When providing password on the command line you should leave no space after -p.
It should look smth like:
mysqldump -u root -proot mig >file.sql;
You can use some tools like MySQL Workbench or SQLyog to import the dump file.
Free version: https://code.google.com/p/sqlyog/wiki/Downloads
When you execute mysqldump from command line, you must have mysql_home/bin directory in your classpath variable or command-line must be pointing to it.
try using
mysqldump -u root -proot mig >(abs_path)/file.sql;
This works for me on my local. Open Terminal and execute the following code (Make sure your are NOT on the MySQL prompt):
mysqldump -uroot -p mig > file.sql
It will ask you to input the password on the next line, for security the password won't be shown.
If you get Access Denied, means the mysql credentials are wrong (or the user you use don't have the right permissions to generate a dump), so make sure you have a valid username and password. I hope it helps.
mysqldump will not run from mysql cli, you will have to run it from windows command prompt:
mysqldump -u username -p database_name > output_file_name.sql;
If you are getting error on running above command 'mysqldump is not recognized as an internal or external command' then navigate to < MySQL Installation Directory/bin/ > and then run the command.
i have the same problem, my situation was i connect from client in local computer to server in SQL instance of Google. Since i read Sahil Mittal said this is comman utilty, i just put in terminal the same command adding -h parameter.
mysqldump -h ip.del.host -u root -p database_name > database_desired_name.sql

Using Heroku Postgres database locally in a Rails 3 app

I have downloaded the database from an existing Heroku app onto my local machine. The data I downloaded is in a single file; let's call it herokuapp.db. I also have Postgres installed and I can successfully create a new Postgres database and have my Rails app reference that. What I want to do is move the data I downloaded from Heroku into this database or create a new Postgres database using the downloaded data.
Use pg_restore --verbose --clean --no-acl --no-owner -d [database_name] [herokuapp.db]
see https://devcenter.heroku.com/articles/export-from-heroku-postgres for more information
I just solved the same problem with a similar technique that Will suggested (thanks Will!).
$ heroku pgbackups:capture
$ curl -o latest.dump `heroku pgbackups:url`
$ pg_restore --verbose --clean --no-acl --no-owner -d [database_name] latest.dump
The database_name can be found in the development section of the database.yml file.
EDIT
I recently performed this task again with Postgres.app and the last command above did not work. I was getting this error message:
pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database "[database_name]" failed: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
pg_restore: *** aborted because of error
Here is the updated command that worked:
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U $USER -d [database_name] latest.dump