Please I really need help here. I uninstalled my WAMP SERVER. And I forgot to export my database before uninstalling, but I successfully copied the my c:\\wamp folder. Is there a way I can recover my database from the copied files?
The database files are in the C:\wamp\mysql\data folder. I would recomend reinstalling the wamp and recovering the database from there.
Related
After developing in Rails on a virtual Linux machine, I just recently installed Windows Subsystem for Linux. Before the Christmas weekend, it was working just fine, but as of this morning, when I try and start up my rails server, it gives me the following complaint:
Could not load database configuration. No such file - ["config/database.yml"]
Of course, when I go into my config folder, database.yml is there - just like it was last week. So I'm confused why it can't find the file now when it absolutely could find it before. Is this some sort of WSL quirk that makes the file hard to find for some reason?
This is most likely guesswork, but I assume that there is a permission issue. If config/database.yml has insufficient ownership or read-levels, it may not be found by your Rails application.
For further diagnose, I recommend posting the output of:
# Get permission details for your config
ls -laZ config/database.yml
And maybe some details of which user is starting the Rails application (effectively which user owns the Ruby process).
I am new to Ruby on rails. Recently I am working on a project done halfway by another programmer. What I did was I cloned his repository and installed all the required bundles and gems etc so that I can run development locally. It used to work all the time when I run rails server and visit localhost:3000
However, today I set up a dual boot Ubuntu alongside windows 8.1. Then, I followed the exact same process as before to install required gems and set up the environment.
However, this time, when I run rails server and visit localhost:3000
I run into the following problem:
could not connect to server: Connection timed out Is the server running on host "xx.xx.xx.xxx" and accepting TCP/IP connections on port 6543?
This is weird, because it used to work without me configuring anything on the database.yml.
If I start a new rails project and do
rails new projectName -d postgresql
it works fine after I edited the database.yml file to the correct credential.
So my question is, if I cloned a repository and started to collaborate with another programmer on the project, how should I set up the postgresql database for me?
Thank you very much.
If you want to make possible for everyone to have their own local database configuration, consider to create database.yml.example file. Some people think that it's a bad practice, from my experience, it's very handy.
How to make it:
Rename database.yml to database.yml.example.
Commit it
Add database.yml to .gitignore and commit this change.
Make a copy of database.yml.example and rename it back into database.yml.
Now when someone will clone your repo, she will have to create her own database.yml file from .example. So everyone will have his own database configuration.
Ok, I found the problem. It is the host address, I was using the wrong host address because my co-programmer changed the address. So, ya, if the host is correct in the database, then you should be able to see the page
I managed to delete to following files with git clean in my rails app:
Removing .DS_Store
Removing .bundle/
Removing config/application.yml
Removing db/development.sqlite3
Removing log/development.log
Removing public/system/profiles/avatars/000/000/011/
Removing public/system/profiles/avatars/000/000/012/
Removing tmp/
Are there any chances of getting back these files somehow or being able to copy from somewhere else? (Git deletes files permanently, so trash is empty. I also tried w/ disk drill but id didn't work out either.)
How can I protect my gitignored files properly to avoid these kinda situations in the future? Should I copy them sometimes or there are other programs to handle this?
Do I have to recreate my rails app or somebody knows a better option?
I think you can try to find these files in previous commits.
Next time remove using command git rm --cached file_name
I was able to pull it off. I ran bundle install (creates the files within .bundle) and reinstalled sqlite and figaro. After that I ran rake db:migrate which created the development.sqlite3 file. I lost the development data, but it is not a huge problem at all. For figaro I had to retype the keys and passwords (Sendgrid, Stripe, etc.) into the new application.yml file. Temporary and log files don't seem to be important. Thanks for the answers. This $git clean is pretty dangerous, watch out!
I am working on a rails app. Due to some messing up with the code I deleted the app from my local development machine and cloned the previous commit from the git repo.
Now i want to delete the db file(postgres) of the deleted one from the local machine as well. I had issues in the past that made me unable to access several features due to database conflicts(due to same db name). So i fixed that by removing the database and recreating with the cloned app. I had done it before from commandline but i forget now on how to do it. Could some one tell me where is the postgres database file located in ubuntu or how to remove from commandline? Thanks in advance.
There is a postgresql shell command dropdb which you can use.
After a bit of searching i found that doing this will remove the database. From the commandline just cd into your app directory and run this command
rake RAILS_ENV='development' db:drop
This will remove the database(although am still unable to find the exact location where its stored physically in hard drive). This is the solution if you cant access rails console, or some rake commands.
After that we can just recreate the database using
rake db:create
I have a Rails 4 app version controlled with git.
I would like to have a version of database.yml on my server that never changes. What's the best way to allow me to continue to edit this file locally, without changing the remote database.yml file?
You should include your local version of database.yml in .gitignore, so that it's not in the repository and won't change with subsequent deployments.
For instance, in your application root, create a ".gitignore" file and add the following in:
config/database.yml
You can also hide entire directories:
config/*
Basic shell wildcard syntax will work.
*.sql
Etc.
Take it out of version control, it shouldn't be there anyway.
We don't track our config/database.yml in version control (we do track a sample file so it's easier to get setup on new development machines). Our deployment script symlinks in a custom database.yml that's stored in the application user's home directory with permissions set to "600". This way the app user is the only user that can see the database password, and we don't have to do anything manual on deploy.
move database.yml to some secure folder, like /etc/config/database.yml and then create symlink
of that file with rails database.yml after deployment but before starting server.