Ads Top

Create Cockroach DB database and user

Cockroach DB useful commands.

Here are some useful cockroach DB commands and steps to create a cockroach DB database and uses of cockroach DB database.

  • Create CockroachDB database :
CREATE DATABASE cockroachdb;
  • Create CockroachDB Database User :
CREATE USER cockroachdb WITH PASSWORD 'vishal';   
  • Grant Privileges on CockroachDB Databases :
GRANT ALL ON DATABASE cockroachdb TO cockroachuser;
GRANT ALL ON TABLE cockroachdb.* TO cockroachuser;
  • Change cockroach db user password :
ALTER USER vishal WITH PASSWORD 'newpassword';
  • Login to kubernetes deploy cockroach :
psql 'postgresql://username@ip:26257?sslmode=allow'
  • Import Cockroach db Dump :
psql -p 26257 -h host -d database -U vishal < database.sql
  • How to rename Cockroach database :
ALTER DATABASE olddbname RENAME TO newdbname;

Privilege Levels
ALLDatabase, Table
CREATEDatabase, Table
DROPDatabase, Table
GRANTDatabase, Table

No comments:

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + ''; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();
© 2020 Vishal Vyas. All rights reserved. Theme images by Jason Morrow. Powered by Blogger.