Hi Dav! This is helping me make great progress when I had been running into this issue for awhile now. However, when I run this, I got prompted for the password for my user but was unable to type anything. Do you know how I could add it to the original prompt so it is included?
Hereās how to do that in Windows 10:
1- right click on the windows (Aka āStart buttonā)
2- select āSystemā (you can reach there from: Settings - About)
3- in the right menu, click on āAdvanced system settingsā
4- in the window that popped, click on the bottom button that reads āEnvironment Variablesā¦ā
5- in the upper block, click on the variable that reads āPathā (double-click)
6- in the āEdit environment variableā click new
7- in the new line you should enter your path to \bin folder of your postgreSQL (default for version 13: āC:\Program Files\PostgreSQL\13\binā yours might be different look it up)
8- back track with āOkā to close all the 3 open windows.
9- now you can open cmd and enter the command @davbyron provided: psql -U <username> -d <your-baseball-database-name> -f baseball_database.sql
Update: I got all the data to load. Itās been about a week since I tried, but I uninstalled postgres version 13.1 and downloaded postgres version 12.5 instead which may have been the difference (or maybe someone fixed the .sql file not sure either way it works now).
This worked for me. I tried some of the command line stuff with no luck. Simply downloading postgres 12.5 instead of 13 made it all work. Iām using the same SQL file, so it is the version of postgres that is the issue.
Hey everyone, I was facing a major problem when trying to import Baseball.sql file.
I kept getting this error āauthentication method 10 not supportedā.
I managed to overcome this error by using the SQL Shell (psql) provided after installing PostgreSQL and Postbird, well one of them .
You have to login into the postgres user or whatever user you created
connect to the database you want the data inserted too, I named mine Baseball: postgres=# \c Baseball
Using the ā\iā command just select the past the file path for the sql file you want to import: Baseball=# \i '.../TheBestOfBaseballAwards/baseball_database.sql'.
Every time have error like this: Select database ābaseballā ERROR: Can not find psql in a system. Make sure PostgreSQL client is installed. On Ubuntu/Debian - package āpostgresql-clientā On RHEL/Fedora - package āpostgresqlā FAILURE
Reinstalled Postbird - didnāt help
Reinstalled PostgreSQL to version 12 - didnāt help
Downloaded āpostgresql clientā - didnāt help
Maybe itās time to download SQLite and forget about postgresā¦
Thanx!! Iāve tried all the other options and didnāt work,. I didnāt want to downgrade postgres as it is suggested above⦠but your method did the trick! You are awesome!
(I work on windows10, postgres13)
I did everything @siger212 said and it worked for me. Make sure you close your cmd window and reopen it prior to running the final command that @davbyron provided. I also work on Windows 10, thanks for the help all!
if you need a little more detail than what darkcookie says (thanks for putting me on the right path darkcookie):
Open command prompt and go to where your psql bin is. Mine was āC:\Program Files\PostgreSQL\13\binā
Login to the database with user via command like this: āpsql -U postgres -D codecademy_baseballā
Type the \i and then the full path to your file in quotes. psql doesnt like , it expects / so you can copy your file location from file explorer but replace the backslashes with forwardslashes. Like: ā\i āC:\Users\MysteryMachine\Downloads\TheBestOfBaseballAwards\TheBestOfBaseballAwards\baseball_database.sqlāā
The reason is whatever editor is reading the sql query⦠it has no concept of reading from stdin (thats a programming thing I havent used in a LONG time, where you tell the system to read in from the command line). So when it (pgadmin or other non-command line tools) hits that plain text data its expecting a sql statement (since its after the statement terminator of a and instead it gets a number etc so it doesnt know how to interpret and errors.
What I didnt know, till now, is there is this notion of āimportā in Psql where it runs it like a command prompt which you could do in Postbird. Unfortunately however Postbird authenticates to run in this command prompt mode uses an old authentication method so its not working with the newest postgres.
I was able to load this in remotely without much trouble running postgres 13 on a raspberry pi.
Run a Postgres docker container on the Pi
docker run -d -p 5432:5432 -e POSTGRES_USER=baseball -e POSTGRES_PASSWORD=changeme postgres
Run psql.exe on laptop to connect to the database (will be called baseball) -pgadmin and postgres come with this tool
Run \i against the .sql fileās path - on windows psql still uses forward slash - if you do backslash it will give you āaccess deniedā e.g. \i c:/temp/baseball.sql
I am using pgadmin so the GUI did not have a pretty frontend for importing this type of SQL dump.
@davbyron solution worked out for me but I had to try multiple times until I realized after āf-ā you must include the path to your file. Perhaps obvious to most but Iām a total beginner so I guess others will face the same issue.
You are then required to type your database password. When you type, youāll see nothing on your screen. By default, Microsoft CMD does not display what you type, and hereās how it looks in CMD :