This project is archived and is in readonly mode.
Better db:create for mysql - do not assume root user
-
Pratik
- Title changed from [PATCH] better db:create for mysql - do not assume root user to Better db:create for mysql - do not assume root user
-
Pratik
- State changed from new to wontfix
I am not sure it's the best idea to make this interactive. This is useful only in development machines and it's easy to just manually create the db if needed.
Thanks !
-
Vladimir Dobriakov
The first problem is a misleading error message regarding charset and collation instead of "access denied".
Regarding making the feature interactive - I had this concerns too. But what is the alternative?
-
keep the db:create feature non-working, especially for production where your root account (hopefully ;-) ) always has a non-empty password
-
provide the root password on the command line. The problem is the password is saved in the command history then
-
ask for the root password interactively when creating the database - always happens anyway, even with
mysql
Or did I overlooked something and there is a possibility for a secure password-less root account in MySQL? There is nothing like certificate-based ssh-like login in MySQL or is there?
Could you outline, how do you deploy (production) or create (development) a new Rails application with a MySQL database.
Thanks!
-
-
Pratik
- Assigned user set to Michael Koziarski
-
Michael Koziarski
- State changed from wontfix to stale
-
Vladimir Dobriakov
Checked against current 2.3-stable branch - applies cleanly.
Checked with a sample application:
rails app1 cd app1 vi config/database.ymlPut following:
production: adapter: mysql database: app1 username: app1identity password: secret1 host: 127.0.0.1 encoding: utf8Now run the rake task
RAILS_ENV=production rake db:createThe old implementation returns:
Couldn't create database for {"encoding"=>"utf8", "username"=>"app1identity", "adapter"=>"mysql", "database"=>"app1", "host"=>"127.0.0.1", "password"=>"secret1"}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)
Please also note the misleading error message.
The new one:
Access denied for user 'app1identity'@'localhost' (using password: YES). Please provide the root password for your mysql installation >New database is created.
-
Repository
- State changed from stale to committed
(from [64756e8f718c90a17664f2d35993696d8bf0f81e]) better db:create for mysql - do not assume root user
Signed-off-by: Michael Koziarski michael@koziarski.com
[#1459 Better db:create for mysql - do not assume root user state:committed] http://github.com/rails/rails/commit/64756e8f718c90a17664f2d3599369...
