# Ysqlsh: FATAL: role "yugabyte" does not exist

**URL:** <https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502>\
**Category:** General\
**Created:** [September 24, 2019, 9:18am UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502 "2019-09-24T09:18:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhferreira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/hhferreira/32/158_2.png) [@hhferreira](https://forum.yugabyte.com/u/hhferreira)\
**Post date:** [September 24, 2019, 9:18am UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502/1 "2019-09-24T09:18:28Z")

</div>

While going through the tutorial, I got stuck while trying to initialize ysqlsh to create demo tables and data.

Using Windows 10 with docker containers. Error is:

> ```
> PS YugaByteDB> docker exec -it yb-tserver-n1 /home/yugabyte/bin/ysqlsh -h yb-tserver-n1 --echo-queries
> ysqlsh: FATAL: role "yugabyte" does not exist
> 
> ```

Can you please help? I’m using docker-compose to start the containers with the template provided in the documentation:

> ```
> version: '2'
> 
> services:
> yb-master:
> image: yugabytedb/yugabyte:latest
> container_name: yb-master-n1
> command: [ "/home/yugabyte/bin/yb-master", 
> "--fs_data_dirs=/mnt/disk0,/mnt/disk1", 
> "--master_addresses=yb-master-n1:7100", 
> "--replication_factor=1"]
> ports:
> - "7000:7000"
> environment:
> SERVICE_7000_NAME: yb-master
> 
> yb-tserver:
> image: yugabytedb/yugabyte:latest
> container_name: yb-tserver-n1
> command: [ "/home/yugabyte/bin/yb-tserver", 
> "--fs_data_dirs=/mnt/disk0,/mnt/disk1",
> "--start_pgsql_proxy", 
> "--tserver_master_addrs=yb-master-n1:7100"]
> ports:
> - "9042:9042"
> - "6379:6379"
> - "5433:5433"
> - "9000:9000"
> environment:
> SERVICE_5433_NAME: ysql
> SERVICE_9042_NAME: ycql
> SERVICE_6379_NAME: yedis
> SERVICE_9000_NAME: yb-tserver
> depends_on:
> - yb-master
> 
> ```

Please advise.  
Thanks.

Best Regards,  
Hélder Hugo Ferreira

---

<div class="post-metadata">

**Author:** ![ddorian43](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/ddorian43/32/60_2.png) [@ddorian43](https://forum.yugabyte.com/u/ddorian43)\
**Post date:** [September 24, 2019, 2:09pm UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502/2 "2019-09-24T14:09:58Z")

</div>

Hi hhferreira  
Can you try this ?

````auto
PS YugaByteDB> docker exec -it yb-tserver-n1 /home/yugabyte/bin/ysqlsh -U postgres -h yb-tserver-n1 --echo-queries```
````

---

<div class="post-metadata">

**Author:** ![hhferreira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/hhferreira/32/158_2.png) [@hhferreira](https://forum.yugabyte.com/u/hhferreira)\
**Post date:** [September 26, 2019, 11:28am UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502/3 "2019-09-26T11:28:36Z")

</div>

Unfortunately, did not help as can be seen below:

> PS YugaByteDB\> docker pull yugabytedb/yugabyte  
> Using default tag: latest  
> latest: Pulling from yugabytedb/yugabyte  
> Digest: sha256:0716c8c7d782b8380727d9e0768136fb7f7103f9aebf66fc170978d824ffe425  
> Status: Image is up to date for yugabytedb/yugabyte:latest  
> [docker.io/yugabytedb/yugabyte:latest](http://docker.io/yugabytedb/yugabyte:latest)  
> PS YugaByteDB\> docker-compose up -d  
> Creating network “yugabytedb\_default” with the default driver  
> Creating yb-master-n1 … done  
> Creating yb-tserver-n1 … done  
> PS YugaByteDB\> docker exec -it yb-master-n1 bash -c “YB\_ENABLED\_IN\_POSTGRES=1 FLAGS\_pggate\_master\_addresses=yb-master-n1:7100 /home/yugabyte/postgres/bin/initdb -D /tmp/yb\_pg\_initdb\_tmp\_data\_dir -U postgres” The files belonging to this database system will be owned by user “root”.  
> This user must also own the server process.
> 
> In YugaByte DB, setting LC\_COLLATE to C and all other locale settings to en\_US.UTF-8 by default. Locale support will be enhanced as part of addressing [Issues · yugabyte/yugabyte-db · GitHub](https://github.com/YugaByte/yugabyte-db/issues/1557The) database cluster will be initialized with locales  
> COLLATE: C  
> CTYPE: en\_US.UTF-8  
> MESSAGES: en\_US.UTF-8  
> MONETARY: en\_US.UTF-8  
> NUMERIC: en\_US.UTF-8  
> TIME: en\_US.UTF-8  
> The default database encoding has accordingly been set to “UTF8”.  
> The default text search configuration will be set to “english”.
> 
> Data page checksums are disabled.
> 
> creating directory /tmp/yb\_pg\_initdb\_tmp\_data\_dir … ok  
> creating subdirectories … ok  
> selecting default max\_connections … 300  
> selecting default shared\_buffers … 128MB  
> selecting dynamic shared memory implementation … posix  
> creating configuration files … ok  
> running bootstrap script … I0926 11:20:54.900111 42 mem\_tracker.cc:250] MemTracker: hard memory limit is 1.659352 GB  
> I0926 11:20:54.900215 42 mem\_tracker.cc:252] MemTracker: soft memory limit is 1.410449 GB  
> I0926 11:20:54.900596 43 async\_initializer.cc:73] Starting to init ybclient  
> I0926 11:20:54.902719 43 async\_initializer.cc:77] Successfully built ybclient  
> W0926 11:20:54.915623 48 reactor.cc:380] pggate\_ybclient\_R000: Client call yb.master.MasterService.IsInitDbDone has no timeout set for connection id: { remote: 172.27.0.2:7100 idx: 0 protocol: 0x00007fa6284a9d18 → tcp }  
> ok  
> performing post-bootstrap initialization … I0926 11:21:11.094147 81 mem\_tracker.cc:250] MemTracker: hard memory limit is 1.659352 GB  
> I0926 11:21:11.094249 81 mem\_tracker.cc:252] MemTracker: soft memory limit is 1.410449 GB  
> I0926 11:21:11.094722 82 async\_initializer.cc:73] Starting to init ybclient  
> I0926 11:21:11.096873 82 async\_initializer.cc:77] Successfully built ybclient

and then when trying to run ysqlsh to connect to the service :

> PS YugaByteDB\> docker exec -it yb-tserver-n1 /home/yugabyte/bin/ysqlsh -h yb-tserver-n1 --echo-queries  
> ysqlsh: FATAL: role “yugabyte” does not exist  
> PS YugaByteDB\> docker exec -it yb-tserver-n1 /home/yugabyte/bin/ysqlsh -U postgres -h yb-tserver-n1 --echo-queries  
> ysqlsh: FATAL: database “postgres” does not exist

Please advise.  
Thanks.

Regards,  
Hélder Hugo Ferreira

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [September 26, 2019, 12:39pm UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502/4 "2019-09-26T12:39:47Z")

</div>

Can you tell me which tutorial you’re using ?

---

<div class="post-metadata">

**Author:** ![hhferreira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/hhferreira/32/158_2.png) [@hhferreira](https://forum.yugabyte.com/u/hhferreira)\
**Post date:** [September 26, 2019, 4:31pm UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502/5 "2019-09-26T16:31:08Z")

</div>

Sure, following URL used to launch docker: [Deploy | YugabyteDB Docs](https://docs.yugabyte.com/latest/deploy/docker/docker-compose/#3-test-the-apis)

… and this one to create tables and sample data: [YugabyteDB Quick start for macOS | YugabyteDB Docs](https://docs.yugabyte.com/latest/quick-start/explore-ysql/#docker)

Any further hints?

Thanks in advance.

Best Regards,  
Hélder Hugo

---

<div class="post-metadata">

**Author:** ![neha](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/neha/32/231_2.png) [@neha](https://forum.yugabyte.com/u/neha)\
**Post date:** [September 26, 2019, 6:34pm UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502/6 "2019-09-26T18:34:17Z")

</div>

Hi @hhferreira,

It looks like YSQL didn’t end up getting initialized on your cluster. Can you please use this updated `docker-compose.yaml`?

```auto
version: '2'                                                                                         
                                                                                                     
services:                                                                                            
  yb-master:                                                                                         
      image: yugabytedb/yugabyte:latest                                                              
      container_name: yb-master-n1                                                                   
      command: [ "/home/yugabyte/bin/yb-master",                                                     
                "--fs_data_dirs=/mnt/disk0,/mnt/disk1",                                              
                "--master_addresses=yb-master-n1:7100",                                              
                "--replication_factor=1",                                                            
                "--enable_ysql=true"]                                                                
      ports:                                                                                         
      - "7000:7000"                                                                                  
      environment:                                                                                   
        SERVICE_7000_NAME: yb-master                                                                 
                                                                                                     
  yb-tserver:                                                                                        
      image: yugabytedb/yugabyte:latest                                                              
      container_name: yb-tserver-n1                                                                  
      command: [ "/home/yugabyte/bin/yb-tserver",                                                    
                "--fs_data_dirs=/mnt/disk0,/mnt/disk1",                                              
                "--start_pgsql_proxy",                                                               
                "--tserver_master_addrs=yb-master-n1:7100"]                                          
      ports:                                                                                         
      - "9042:9042"                                                                                  
      - "6379:6379"                                                                                  
      - "5433:5433"                                                                                  
      - "9000:9000"                                                                                  
      environment:                                                                                   
        SERVICE_5433_NAME: ysql                                                                      
        SERVICE_9042_NAME: ycql                                                                      
        SERVICE_6379_NAME: yedis                                                                     
        SERVICE_9000_NAME: yb-tserver                                                                
      depends_on:                                                                                    
      - yb-master

```

The main change is passing `enable_ysql=true` flag to yb-master process.

Steps to get it working will then be:

1. `docker-compose down` : This will remove existing cluster
2. `docker-compose up -d` : Create cluster using the new yaml
3. `docker exec -it yb-tserver-n1 /home/yugabyte/bin/ysqlsh -h yb-tserver-n1 --echo-queries` : Connect to YSQL shell.

Let me know if this works.

---

<div class="post-metadata">

**Author:** ![hhferreira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/hhferreira/32/158_2.png) [@hhferreira](https://forum.yugabyte.com/u/hhferreira)\
**Post date:** [September 27, 2019, 8:26am UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502/7 "2019-09-27T08:26:23Z")

</div>

Still not working ☹

> PS YugaByteDB\> docker exec -it yb-tserver-n1 /home/yugabyte/bin/ysqlsh -h yb-tserver-n1 --echo-queries  
> ysqlsh: FATAL: Not found: Error loading table with oid 1260 in database with oid 1: The object does not exist: table\_id: “000000010000300080000000000004ec”

Could it be an error in the latest docker image?

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [September 27, 2019, 1:17pm UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502/8 "2019-09-27T13:17:10Z")

</div>

Just tried with the latest docker image in a clean environment using the config from neha.  
Can you repeat again doing steps:

1. `docker-compose stop`
2. `docker-compose rm`
3. `docker-compose up -d`
4. `docker exec -it yb-tserver-n1 /home/yugabyte/bin/ysqlsh -h yb-tserver-n1 --echo-queries`

Those commands run serially should work.  
Taken from: [Deploy | YugabyteDB Docs](https://docs.yugabyte.com/latest/deploy/docker/docker-compose/)

Can you also run `ps -ef` and confirm that `yb-master` was started with `—enable_ysql`?

Can you also print the version that you’re using by doing `select version();` in YSQL ?

---

<div class="post-metadata">

**Author:** ![hhferreira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/hhferreira/32/158_2.png) [@hhferreira](https://forum.yugabyte.com/u/hhferreira)\
**Post date:** [September 27, 2019, 2:30pm UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502/9 "2019-09-27T14:30:08Z")

</div>

Thanks! Working now, I had a weird character in my docker-compose.yaml file and the latest change to include the —enable\_ysql was not being run. Nevertheless, i suggest you to update the documentation about the docker-compose.yaml definition to include this flag.

Best Regards,  
Hélder Hugo Ferreira

---

<div class="post-metadata">

**Author:** ![neha](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/neha/32/231_2.png) [@neha](https://forum.yugabyte.com/u/neha)\
**Post date:** [September 27, 2019, 4:55pm UTC](https://forum.yugabyte.com/t/ysqlsh-fatal-role-yugabyte-does-not-exist/502/10 "2019-09-27T16:55:11Z")

</div>

Good to see that it’s working now!  
We’ve updated documentation as well, thanks for the feedback.

-Neha
