5
CREATE TABLE student 
(
    student_id INT PRIMARY KEY, 
    nam VARCHAR (20),
    major VARCHAR (20)
);

I'm just running this code and I keep getting a permission denied for schema public message. What does this mean and how can I fix it.?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
noobguy
  • 115
  • 1
  • 1
  • 5
  • GRANT ALL ON schema public To YourUser; But you need to be connected as an admin to grant that to your YourUser – zip Jan 05 '20 at 21:26

6 Answers6

4

I see you are asking this in reference to the freeCodeCamp's SQL course by the looks of it.

You need to create your own database and you should be good to go, see the steps below:

  • Open mySQL command line and create a new database CREATE DATABASE TestDB
  • Open PopSQL > File > Preferences > Connections > Add New Connection > MySQL
  • Connection name: any name
  • Hostname/Port: localhost | 3306 (3306 is default port number, maybe you used/have different port during MySQL installation)
  • Database: TestDB
  • Username: root | Password: (this is what you set when you installed MySQL)
  • Connection Type: turn this ON, you want to "Connect directly from my computer"

Test connection, if successful, save.

Also, please note this is working on MySQL Server 5.7.20, it may be different on other versions.

John Doe
  • 105
  • 11
3

Please make sure you are using the right database, in the popSQL the "PopSQL Sample Data" database is selected by default.

you can change it as mentioned below

enter image description here

Saif Faidi
  • 509
  • 4
  • 15
2

It means you are using POPsql sample data. Click on manage connections and add a connection to your own database.

1

You need to add your own new connection instead of running it on POPsql sample data private connection

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 29 '21 at 01:18
1

just delete the other sample server from the list of connections and add your own.

NabanitaD
  • 11
  • 1
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 29 '21 at 08:54
1

I see you are asking this in reference to the freeCodeCamp's SQL course as the same with me, what you really need to do is make sure you follow all of his instructions and after that make sure you change the connection to MySQL after add the new connections.

enter image description here