Split database in magento-2.3.3 at localhost - magento2

I have tried to split magento databases. I have tried following things.
create database magento_quote;
GRANT ALL ON magento_quote.* TO magento_quote#localhost IDENTIFIED BY 'magento_quote';
create database magento_sales;
GRANT ALL ON magento_sales.* TO magento_sales#localhost IDENTIFIED BY 'magento_sales';
When I am running the following command I am getting error like
Command "setup:db-schema:split-quote" is not defined.
php bin/magento setup:db-schema:split-quote --host="127.0.0.1" --dbname="magento_quote" --username="magento_quote" --password="magento_quote

Related

MongoDB database creation issue

I am using MongoDB. All I want to do is add a collection to a database I have created. I verified before I even started that the database existed by running the command "show dbs". However, when I try to add the collection to that database, it says that this database is undefined. Any thoughts or suggestions? Here were the commands I typed in terminal
use myDB
myDB.myCol.insert({"id":"1"})
the response I got from this command is "myDB is not defined" even
though I verified that it exists with the command "show dbs".
Use db instead of the name of the database in your insert command:
db.myCol.insert({"id":"1"})
use MyDB sets which database db refers to.

newly installed postgres startup error

I have installed postgres & also started the server. But, when I tried to start console using psql, I'm getting error like database "****"(any database) does not exists. How to resolve this error?? I don't have acces to psql shell. And is there other way to create or change startup database without accessing psql.

razor-admin migrate-database failing on IDENT Error when razor user can log in to the database

https://gist.github.com/predatorian3/fbf6d34b0a9958212c3c
I recently tried to setup Razor Server using the documetnation provided here:
https://github.com/puppetlabs/razor-server/wiki/Installation
https://docs.puppetlabs.com/pe/latest/razor_prereqs.html
https://docs.puppetlabs.com/pe/latest/razor_install.html
I started with a fresh install of CentOS 6 on Vagrant, and installed PostgreSQL server, and Client. Then I installed the puppet-labs RPM from the documentation. I created the user using:
su - postgres
createuser -P razor
createdb -O razor razor_prd
Then I edited the /etc/razor/config.yml file to reflect the password of razor for the razor user in the database_url for production. Then when I execute the database migration as root, postgres and razor, I get different errors listed in the Gist at the beginning of the question.
[vagrant#centos6 ~]$ sudo su - razor -c "razor-admin --environment production migrate-database"
Sequel::DatabaseConnectionError: Java::OrgPostgresqlUtil::PSQLException: FATAL: Ident authentication failed for user "razor"
make_new at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool.rb:99
make_new at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:158
available at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:137
acquire at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:127
sync at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:194
synchronize at org/jruby/ext/thread/Mutex.java:149
sync at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:194
acquire at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:126
hold at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:94
synchronize at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/database/connecting.rb:234
server_version at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/adapters/shared/postgres.rb:442
supports_create_table_if_not_exists? at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/adapters/shared/postgres.rb:458
create_table? at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/database/schema_methods.rb:211
schema_dataset at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/extensions/migration.rb:585
initialize at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/extensions/migration.rb:443
initialize at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/extensions/migration.rb:505
run at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/extensions/migration.rb:390
apply at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/extensions/migration.rb:361
(root) at /opt/razor/bin/razor-admin:41
call at org/jruby/RubyProc.java:271
(root) at /opt/razor/bin/razor-admin:84
However I can log in as the razor user into the database and poke around, and I have reset teh razor user's password as postgres and still can log in as the razor user. However, I keep running into the error listed above. What am I doing wrong?
--EDIT 2015-08-18 --
I added the lines above the other entries in the pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
local all all trust
host all all 127.0.0.1/32 trust
Now, I'm getting a SQL error saying:
E, [2015-08-19T16:26:10.028000 #2203] ERROR -- razor.sequel: Java::OrgPostgresqlUtil::PSQLException: ERROR: syntax error at or near "DEFERRABLE"
Position: 95: ALTER TABLE "policies" DROP CONSTRAINT "policies_rule_number_key", ADD UNIQUE ("rule_number") DEFERRABLE INITIALLY DEFERRED
I, [2015-08-19T16:26:10.046000 #2203] INFO -- razor.sequel: (0.003000s) ROLLBACK
Sequel::DatabaseError: Java::OrgPostgresqlUtil::PSQLException: ERROR: syntax error at or near "DEFERRABLE"
Position: 95
I believe that this is something to do with the SQL in Razor.
What I had to do was update the database to the latest version. The version of PostgreSQL in CentOS default repos was 8.4 which is deprecated. Then I also had to white list the local, and host settings again for trust. Then restart PostgreSQL and the migration worked.

could not open file error with PostgreSQL

I am using PostgreSQL and Centos
While in the the task database I am trying to do this
COPY CUSTOMERS TO '/home/cjones/cfolder/customers.txt' (DELIMITER '|');
I am getting the
Error: could not open file "/home/cjones/customers.txt" for writing: Permission denied
I have done ls -al and chmod the customers.txt to 777 and still getting this error. Any ideas?
Are you aware of all requirements? Per documentation:
1.
You must have select privilege on the table whose values are read by
COPY TO
2.
COPY naming a file or command is only allowed to database superusers,
since it allows reading or writing any file that the server has
privileges to access.
Plus, for the file to be accessible by the server it must lie on the same machine of course. And the directory must be accessible to the user the postgres server runs as, typically postgres (not only the file).
An alternative would be to use the \copy meta-command of psql.

Can't connect to local Firebird with ISQL

I'm trying to setup a local firebird instance to test against but am unable to connect to it with even ISQL. I have tried to following by following the quick start guide here:
CONNECT ..\examples\empbuild\employee.fdb user SYSDBA password masterkey;
Which resulted in:
Statement failed, SQLSTATE = 08001
unavailable database
After some searching I tried modifying that to:
CONNECT "localhost:C:\Program Files\Firebird\Firebird_2_5\examples\empbuild\employee.fdb" user SYSDBA password masterkey;
Which resulted in:
Statement failed, SQLSTATE = 28000
cannot attach to password database
After confirming I had the right directory path I decided to give on on connecting for now and try creating a new DB:
SQL>CREATE DATABASE 'C:\data\test.fdb' page_size 8192
CON>user 'SYSDBA' password 'masterkey';
Which also gave me the error:
Statement failed, SQLSTATE = 08001
unavailable database
Are there any common pitfalls I might be hitting? I've also tried the commands above both with and without the firebird service running. Also is there a detailed reference on the SQLSTATE codes?
As already mentioned in my comments the problem is caused by running the Firebird server as an application. Firebird has its password database (security2.fdb) in C:\Program Files\Firebird\Firebird_2_5. As this database is (almost, but not entirely) a normal Firebird database, the server requires write access to this database (for the transactions, etc).
By default (with UAC) users do not have write access to the password database, so this requires elevation to Administrator. So access to Firebird requires that you either run the application as a service with sufficient rights (eg as done by the default installer), or when running the server as application to run it 'As administrator'. Another option is to not install it in Program Files.
This BTW applies double when accessing the example employee database as this database file is also located in the Program Files folder.
This is for macOS/OSX (mine is 10.15) firebird ver 2.5 users.
The installation process here does not ask for a sysdba password. Which means: the security database 'security2.fdb' does not exist after a new installation.
This seems to be intentionally for security reasons since > ver 2.5.
To create one, we use the demo database as a helper:
open sql as su: >sudo isql (we don't have user rights on dir)
Connect to a existing db:
sql>connect
"/Library/Frameworks/Firebird.framework/Resources/examples/empbuild/employee.fdb
" user 'SYSDBA' password 'masterkey';
Now we created the missing file 'security2.fdb' in the folder:
"/Library/Frameworks/Firebird.framework/Resources/English.lproj/var/"
(jro)