suyLog

Suy.Log();

prisma init시 에러 – P1013: The provided database string is invalid

$ npx prisma migrate dev --name init

Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": MySQL database

Error: P1013: The provided database string is invalid. invalid port number in database URL. Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.

.env 파일 안의 DATABASE_URL의 비밀번호값에 특수문자가 들어가 있기 때문이었다.

mysql://USER:PASSWORD@HOST:PORT/DATABASE

percent-encoding를 참고해서 해당 특수문자를 percent encoding으로 변경 후 해결

또는 https://meyerweb.com/eric/tools/denco 에서 인코딩

Percent-encodings

Following are the percent-encodings for the frequently used special characters:

Special CharacterPercent Encoding
!%21
#%23
$%24
%%25
&%26
'%27
(%28
)%29
*%2A
+%2B
,%2C
/%2F
:%3A
;%3B
=%3D
?%3F
@%40
[%5B
]%5D
newline%0A or %0D or %0D%0A
space%20
"%22
%%25
-%2D
.%2E
<%3C
>%3E
\%5C
^%5E
_%5F
`%60
{%7B
|%7C
}%7D
~%7E
£%C2%A3
%E5%86%86

prisma can’t connect to postgresql – Stack Overflow

Leave a Comment

Your email address will not be published. Required fields are marked *