I have a website already hosted on heroku.I added all content in the remote refinery.now i hosted the same website on apache using passenger.And i want to copy the content from the heroku refinery to the apache one.How do i go about it?
my database.yml file is as follows:
development:
adapter: mysql2
encoding: utf8
database: app_development
pool: 5
username: root
password: root
test:
adapter: mysql2
encoding: utf8
database: app_test
pool: 5
username: root
password: root
production:
adapter: mysql2
encoding: utf8
database: app_production
pool: 5
username: root
password: root
Im using ubuntu 13.10
Is this your new database.yml file? or were you using mysql on heroku too (most people use postgres)?
working on the assumption that you were on postgres on heroku and want to move to a mysql local database you will first need to copy your database information onto your new server.
For information on how to get the data off've your heroku database see here and here, the relevant line is here:
$ PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump
Now you'll have a postgres backup file that will be all the sql commands needed to recreate the backup with all your data, you would think that since sql is a standard and mysql uses that too you could just do
mysql my_new_database_name < mydb.dump
Unluckily you're often not that lucky (I would recommend trying it, you never know with simple enough database structures) and you will then need to use a converter, this question recommends using pg2mysql.
This does of course bring up the question of why you want to move to a mysql installation?
Here is an article by digital ocean comparing sqlite, mysql and postgres, which has this to say about postgres.
PostgreSQL is the advanced, open-source [object]-relational database
management system which has the main goal of being standards-compliant
and extensible. PostgreSQL, or Postgres, tries to adopt the ANSI/ISO
SQL standards together with the revisions.
For my own opinion I quite like postgresql and find it has less unpleasant surprises than mysql but YMMV. Given the extra work in switching databases I'd probably be inclined to stick to Postgres but that's my opinion.
Related
I use JDBC and Spring Boot 2.2.2 to connect to a MariaDB instance. The login fails with this message:
Caused by: java.sql.SQLInvalidAuthorizationSpecException: Could not
connect to
address=(host=server.company.domain)(port=3306)(type=master) : Access
denied for user 'user'#'server.company.domain' (using password:
YES)
When I run mysqldump -u"user" -p"password" -h server.company.domain dbname this works just fine !
Both the dump and the Spring Boot application are run from the same machine (the database server itself)
user and password used are identical
there are no special characters in the password or the user (only lower/uppcase characters and digits)
the jdbc connection string looks like this: jdbc:mariadb://server.company.domain:3306/dbname
I already tried to use localhost instead of the server name
when I change jdbc url, user and password the same application is able log in to my development mariaDB
It seems like you are having trouble with MariaDB, not spring-boot itself.
I suggest you to follow this links: https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/, and come back if it didn't solve your problem, with what you tried, and what didn't work.
I ran a short SHOW GRANTS; via the mysql command which is able to connect to the database. The output gave me this:
GRANT ALL PRIVILEGES ON *.* TO 'user'#'%' IDENTIFIED BY PASSWORD 'nonono' REQUIRE SSL WITH GRANT OPTION
The relevant part is REQUIRE SSL: connections to that server need to be done encrypted.
When I checked the files in /etc/my.cnf.d/ I found a file containing (amongst others) these lines:
[server]
ssl=1
ssl-cert=/path/to/certificate/cert.pem
By googling a bit I found this link which describes how to set the JDBC driver to use ssl. It also explains to you why you perhaps should think twice before setting trustServerCertificate to true.
My spring.datasource.url now looks like this:
jdbc:mariadb://server.company.domain:3306/dbname?useSSL=true&trustServerCertificate=true&serverSslCert=/path/to/certificate/cert.pem
To put it short: Access denied for user doesn't tell the complete story. It makes you think that your password might be wrong but you are denied for other reasons.
My application uses the blazer gem for visualizing DB queries.
During the setup I've encountered the following error:
FATAL: no pg_hba.conf entry for host "111.22.33.44", user "blazer", database "my_db", SSL off
My application is hosted on EngineYard and uses PostgreSQL.
How can I find and modify the pg_hba.conf on EngineYard?
upd
I do have SSH access to EngineYard cloud.
Instance: General Purpose (M3) Large.
OS: EngineYard's Gentoo.
You can try the following steps. I've assumed that your DB name is my_db.
Connect to the instance via SSH (the link can be found on the EngineYard environment page)
Connect to the
database as superuser psql -U postgres -h localhost -d
my_db. If you don't have the password, check your database secrets here /data/my_db/current/config/database.yml
After connecting to DB identify location of hba file by typing SHOW
hba_file;
Quit psql by typing \q
Use previously identified path to open the hba_file file and add the missing user. E.g via vim sudo vim /db/postgresql/9.5/data/pg_hba.conf. Note the sudo command
The use should be added under # IPv4 postgres
user for 10.x with md5:
Connect to the database again
Reload the configuration via select pg_reload_conf(); command
After all steps are performed, Blazer queries should be accessible.
I had a Rails project on C9 with a SQLite 3 database. Recently I wanted to switch to a PostgreSQL database to be able to run a project on Heroku. All records from the SQLite 3 database were copied to the PostgreSQL database with the Sequel gem, without any issues. All records were passed to the new database and I was able to see it, however, after rebooting my C9 project, and starting the PostgreSQL service, and connecting it to my database, I found that there weren't any records inside the database. Or, it's not connected yet. I don't get it.
Every time I reboot the project, records from the PostgreSQL database disappear, I have to create a new database and migrate it again to see my records. What am I doing wrong?
Here is list of my actions:
sudo service postgresql start
psql -c "create database myapp_development owner=ubuntu"
sequel -C sqlite://db/development.sqlite3 postgres://ubuntu#""/myapp_development
Then update database.yml file records with:
Development:
- adapter: postgresql
- encoding: SQL_ASCII
- database: myapp_development
- pool: 5
- username: ubuntu
- password: password
Then run:
rake db:migrate
After these actions I can run the project and see my records.
After rebooting the project, I've tried to run the following commands:
sudo service postgresql start
psql myapp_development ubuntu
\c
but it does not help me to see any records.
Please advise me if I've missed any command.
Run psql as the postgres user:
sudo sudo -u postgres psql -d myapp_development -U ubuntu -W
I'm trying to run two MonetDB databases simoultaneously in Windows.
I changed the database name in M5server.bat to mydb, and added -database=mydb to mclient.bat
Then I copied the M5server.bat file and changed the farm to mydb2. I also copied the mclient.bat file and added -database=mydb2.
I run the two server bats to start the two databases and that seems to work fine (no errors).
Then I run the first mclient.bat and it connects to the server with no issues.
But when I run the copied mclient.bat and try to connect using user/password monetdb/monetdb, I get the following error and cannot connect:
request for database 'mydb2', but this is database 'mydb', did
you mean to connect to monetdbd instead?
How to run two databases simoultaneously in Windows? How to connect to two databases at the same time?
You should use different ports for different databases:
Example db1:
mserver5.bat file
--set "mapi_port=50001"
mclient.bat file
-p 50001
Example db2:
mserver5.bat file
--set "mapi_port=50002"
mclient.bat file
-p 50002
Currently PostgreSQL 9.2.4 is provided in OSX Mavericks. I have used the provided PostgreSQL since running Lion Server. When I started using it I was using a password that I now realize is not very secure.
I am having trouble finding the right command to do this. The user/role (I supposed) that is provided is _postgres. This is the password I would like to change. I attempted the command below but honestly I'm not sure what it is supposed to do. I thought that this would allow me to access the role/user.
psql -U _postgres -h localhost -W
Here is what happened when I attempted to execute this command.
xxxx:~ xxxx$ psql -U _postgres -h localhost -W
Password for user _postgres:
psql: FATAL: database "_postgres" does not exist
_postgres is the user for all my databases. I would like to change the password for _postgres. I'm not sure since the databases were created by _postgres that once I change that password if the password will work for the databases or if I will have to change the database passwords also.
All the solutions dealing with this reference directories that I do not have in Mavericks. When I used Lion and Mountain Lion I was able to go to the psql directory and find postgresql.conf and pg_hba.conf. I do a search on those files and do not find them.
Sidebar: I currently use PgAdmin3 for basic database maintenance. The Mac version of the software does not have an option for changing passwords that I can find. If there is another GUI software package that is more user friendly for accessing the provided PostgreSQL I would definitely like to try it. Every solution that suggests Homebrew is in the context of installing another version of PostgreSQL which is not what I want to do.
I need the correct terminal command(s) to do this or help on where to go to get the solution that will work with OS X Mavericks. The PostgreSQL documentation is a bit overwhelming and was not clear as to where to go and what to do regarding this.
Any help would be appreciated.
UPDATE 4/5 6:03 pm CDT
Here are the contents in /Library/Server/PostgreSQL/Data/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication _postgres trust
#host replication _postgres 127.0.0.1/32 trust
#host replication _postgres ::1/128 trust