0

Before this, I executed -u root -p command and it went through, but trying source always gives me this error. I tried running terminal as administrator, moving the source file location, and setting full permissions for everyone on file properties, but nothing is working. Does this have something to do with Users on my laptop/in SQL? I'm very inexperienced with this so sorry if I am misunderstanding something and please be clear with answers.

mysql command prompt output in windows

2
  • @ErgestBasha I'm trying to set the source as a folder that contains a database, as I'm using the database in backend for a site
    – Justin Kim
    Dec 11, 2022 at 22:29
  • 1
    Use forward slash (/), not backslash (``) when presenting file paths to mysql, even on Windows.
    – Rick James
    Dec 11, 2022 at 23:33

1 Answer 1

0

I just tested the sakila_schema in my MySQL on Windows 11 (I do not think it make any difference from Windows10).

I saved the file from Notepad++ to C:\sakila-schema.sql with no special permission given on the file.

I opened cmd as administrator and imported the file using source C:/sakila-schema.sql , note the backslash

C:\Windows\system32>cd C:\Program Files\MySQL\MySQL Server 8.0\bin\
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p
Enter password: *********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.29 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| piggy_client_a     |
| piggy_client_b     |
| piggy_client_c     |
| sakila             |
| sys                |
| w3schools          |
| world              |
+--------------------+
10 rows in set (0.00 sec)

mysql> source C:/sakila-schema.sql

Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 31 rows affected (0.61 sec)
Query OK, 1 row affected (0.01 sec)
Database changed
Query OK, 0 rows affected, 1 warning (0.07 sec)
Query OK, 0 rows affected, 1 warning (0.06 sec)
Query OK, 0 rows affected, 1 warning (0.04 sec)
Query OK, 0 rows affected, 1 warning (0.06 sec)
Query OK, 0 rows affected, 1 warning (0.06 sec)
Query OK, 0 rows affected, 1 warning (0.19 sec)
Query OK, 0 rows affected, 1 warning (0.16 sec)
Query OK, 0 rows affected, 1 warning (0.14 sec)
Query OK, 0 rows affected, 1 warning (0.07 sec)
Query OK, 0 rows affected, 1 warning (0.01 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected, 1 warning (0.07 sec)
Query OK, 0 rows affected, 1 warning (0.05 sec)
Query OK, 0 rows affected, 1 warning (0.08 sec)
Query OK, 0 rows affected, 1 warning (0.10 sec)
Query OK, 0 rows affected, 2 warnings (0.08 sec)
Query OK, 0 rows affected, 1 warning (0.08 sec)
Query OK, 0 rows affected, 3 warnings (0.02 sec)
Query OK, 0 rows affected, 1 warning (0.02 sec)
Query OK, 0 rows affected, 1 warning (0.01 sec)
Query OK, 0 rows affected, 1 warning (0.01 sec)
Query OK, 0 rows affected, 2 warnings (0.01 sec)
Query OK, 0 rows affected (0.01 sec)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.