How to create a database directory structure for MySQL?
up vote
2
down vote
favorite
I was following this tutorial:
https://www.digitalocean.com/community/tutorials/how-to-use-mysql-with-your-ruby-on-rails-application-on-ubuntu-14-04
So far, I installed mysql-server mysql-client libmysqlclient-dev, and I was suppose to tell MySQL to create its database directory structure where it will store its information using sudo mysql_install_db
.
$ sudo mysql_install_db
[WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
[ERROR] The data directory needs to be specified.
I thought running mysqld --initialize
would solve the issue:
$ mysqld --initialize
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[ERROR] Aborting
How do I tell MySQL to create its database directory structure where it will store its information?
mysql ruby database sql ruby-on-rails
add a comment |
up vote
2
down vote
favorite
I was following this tutorial:
https://www.digitalocean.com/community/tutorials/how-to-use-mysql-with-your-ruby-on-rails-application-on-ubuntu-14-04
So far, I installed mysql-server mysql-client libmysqlclient-dev, and I was suppose to tell MySQL to create its database directory structure where it will store its information using sudo mysql_install_db
.
$ sudo mysql_install_db
[WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
[ERROR] The data directory needs to be specified.
I thought running mysqld --initialize
would solve the issue:
$ mysqld --initialize
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[ERROR] Aborting
How do I tell MySQL to create its database directory structure where it will store its information?
mysql ruby database sql ruby-on-rails
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I was following this tutorial:
https://www.digitalocean.com/community/tutorials/how-to-use-mysql-with-your-ruby-on-rails-application-on-ubuntu-14-04
So far, I installed mysql-server mysql-client libmysqlclient-dev, and I was suppose to tell MySQL to create its database directory structure where it will store its information using sudo mysql_install_db
.
$ sudo mysql_install_db
[WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
[ERROR] The data directory needs to be specified.
I thought running mysqld --initialize
would solve the issue:
$ mysqld --initialize
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[ERROR] Aborting
How do I tell MySQL to create its database directory structure where it will store its information?
mysql ruby database sql ruby-on-rails
I was following this tutorial:
https://www.digitalocean.com/community/tutorials/how-to-use-mysql-with-your-ruby-on-rails-application-on-ubuntu-14-04
So far, I installed mysql-server mysql-client libmysqlclient-dev, and I was suppose to tell MySQL to create its database directory structure where it will store its information using sudo mysql_install_db
.
$ sudo mysql_install_db
[WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
[ERROR] The data directory needs to be specified.
I thought running mysqld --initialize
would solve the issue:
$ mysqld --initialize
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[ERROR] Aborting
How do I tell MySQL to create its database directory structure where it will store its information?
mysql ruby database sql ruby-on-rails
mysql ruby database sql ruby-on-rails
edited Sep 4 '17 at 22:34
asked Jul 12 '16 at 8:00
hussam
3618
3618
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
I managed to solve the problem using a previously answered question,
How to install mysql on Ubuntu 16.04, but I needed to modify the solution to work for me.
When I deleted/moved /var/lib/mysql
directory, mysqld --initialize
couldn't create the database directory I want in replacement for /var/lib/mysql
, and it gave me Errcode: 13 - Permission denied
even though I preceded it with sudo
.
I deleted/moved the content of /var/lib/mysql/
, but not the directory itself. I tried again to run sudo mysql --initialize
, and it worked, and created new content within the /var/lib/mysql/
directory. The content produced by mysql --initialize
is different than the previous content I deleted/moved.
I continued the rest of the steps in the tutorial, and worked perfectly.
P.S. I needed to use sudo -i
to access /var/lib/mysql
.
add a comment |
up vote
0
down vote
This is the entire solution for your problem.
According to fromdual, the suggestion is to just follow the
advice of the error. Some functionality is being deprecated.
Our advice is to enable the variable explicit_defaults_for_timestamp
now on your testing systems so you can see if your application behave
well and then you are prepared for the next release when this feature
will become the default.
In short term this warning is NOT dangerous. In the long term you
have to be prepared for the deprecated functionality. You get rid of
the warning my setting explicit_defaults_for_timestamp = 1 in your
my.cnf [mysqld] section.
You can find the my.cnf
file in the following locations, and in
this order the values override each other:
- /etc/my.cnf
- /etc/mysql/my.cnf
- $MYSQL_HOME/my.cnf
- [datadir]/my.cnf
- ~/.my.cnf
You can also find your file by
find / -name my.cnf
I added the following in /etc/mysql/my.cnf
[mysqld]
explicit_defaults_for_timestamp = 1
Now try
mysqld --initialize
And I got a reduced error without Timestamp stuff
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2018-11-12T20:13:45.024116Z 0 [ERROR] Aborting
Is this good? Not sure so I look deeper. According to the aboveaccepted stack
answer for the error you need to
sudo -i #log into root
cd /var/lib/mysql
rm -r *
su username # get back to the original user
mysqld --initialize
This, still gave me the exact same error. No change!
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2018-11-12T20:13:45.024116Z 0 [ERROR] Aborting
I am not sure the above accepted answer helped at all with the removing the
/var/lib/mysql
, but sudo
helped:
sudo mysqld --initialize
worked... No error at all!
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
I managed to solve the problem using a previously answered question,
How to install mysql on Ubuntu 16.04, but I needed to modify the solution to work for me.
When I deleted/moved /var/lib/mysql
directory, mysqld --initialize
couldn't create the database directory I want in replacement for /var/lib/mysql
, and it gave me Errcode: 13 - Permission denied
even though I preceded it with sudo
.
I deleted/moved the content of /var/lib/mysql/
, but not the directory itself. I tried again to run sudo mysql --initialize
, and it worked, and created new content within the /var/lib/mysql/
directory. The content produced by mysql --initialize
is different than the previous content I deleted/moved.
I continued the rest of the steps in the tutorial, and worked perfectly.
P.S. I needed to use sudo -i
to access /var/lib/mysql
.
add a comment |
up vote
2
down vote
accepted
I managed to solve the problem using a previously answered question,
How to install mysql on Ubuntu 16.04, but I needed to modify the solution to work for me.
When I deleted/moved /var/lib/mysql
directory, mysqld --initialize
couldn't create the database directory I want in replacement for /var/lib/mysql
, and it gave me Errcode: 13 - Permission denied
even though I preceded it with sudo
.
I deleted/moved the content of /var/lib/mysql/
, but not the directory itself. I tried again to run sudo mysql --initialize
, and it worked, and created new content within the /var/lib/mysql/
directory. The content produced by mysql --initialize
is different than the previous content I deleted/moved.
I continued the rest of the steps in the tutorial, and worked perfectly.
P.S. I needed to use sudo -i
to access /var/lib/mysql
.
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
I managed to solve the problem using a previously answered question,
How to install mysql on Ubuntu 16.04, but I needed to modify the solution to work for me.
When I deleted/moved /var/lib/mysql
directory, mysqld --initialize
couldn't create the database directory I want in replacement for /var/lib/mysql
, and it gave me Errcode: 13 - Permission denied
even though I preceded it with sudo
.
I deleted/moved the content of /var/lib/mysql/
, but not the directory itself. I tried again to run sudo mysql --initialize
, and it worked, and created new content within the /var/lib/mysql/
directory. The content produced by mysql --initialize
is different than the previous content I deleted/moved.
I continued the rest of the steps in the tutorial, and worked perfectly.
P.S. I needed to use sudo -i
to access /var/lib/mysql
.
I managed to solve the problem using a previously answered question,
How to install mysql on Ubuntu 16.04, but I needed to modify the solution to work for me.
When I deleted/moved /var/lib/mysql
directory, mysqld --initialize
couldn't create the database directory I want in replacement for /var/lib/mysql
, and it gave me Errcode: 13 - Permission denied
even though I preceded it with sudo
.
I deleted/moved the content of /var/lib/mysql/
, but not the directory itself. I tried again to run sudo mysql --initialize
, and it worked, and created new content within the /var/lib/mysql/
directory. The content produced by mysql --initialize
is different than the previous content I deleted/moved.
I continued the rest of the steps in the tutorial, and worked perfectly.
P.S. I needed to use sudo -i
to access /var/lib/mysql
.
edited Apr 13 '17 at 12:25
Community♦
1
1
answered Jul 12 '16 at 9:12
hussam
3618
3618
add a comment |
add a comment |
up vote
0
down vote
This is the entire solution for your problem.
According to fromdual, the suggestion is to just follow the
advice of the error. Some functionality is being deprecated.
Our advice is to enable the variable explicit_defaults_for_timestamp
now on your testing systems so you can see if your application behave
well and then you are prepared for the next release when this feature
will become the default.
In short term this warning is NOT dangerous. In the long term you
have to be prepared for the deprecated functionality. You get rid of
the warning my setting explicit_defaults_for_timestamp = 1 in your
my.cnf [mysqld] section.
You can find the my.cnf
file in the following locations, and in
this order the values override each other:
- /etc/my.cnf
- /etc/mysql/my.cnf
- $MYSQL_HOME/my.cnf
- [datadir]/my.cnf
- ~/.my.cnf
You can also find your file by
find / -name my.cnf
I added the following in /etc/mysql/my.cnf
[mysqld]
explicit_defaults_for_timestamp = 1
Now try
mysqld --initialize
And I got a reduced error without Timestamp stuff
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2018-11-12T20:13:45.024116Z 0 [ERROR] Aborting
Is this good? Not sure so I look deeper. According to the aboveaccepted stack
answer for the error you need to
sudo -i #log into root
cd /var/lib/mysql
rm -r *
su username # get back to the original user
mysqld --initialize
This, still gave me the exact same error. No change!
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2018-11-12T20:13:45.024116Z 0 [ERROR] Aborting
I am not sure the above accepted answer helped at all with the removing the
/var/lib/mysql
, but sudo
helped:
sudo mysqld --initialize
worked... No error at all!
add a comment |
up vote
0
down vote
This is the entire solution for your problem.
According to fromdual, the suggestion is to just follow the
advice of the error. Some functionality is being deprecated.
Our advice is to enable the variable explicit_defaults_for_timestamp
now on your testing systems so you can see if your application behave
well and then you are prepared for the next release when this feature
will become the default.
In short term this warning is NOT dangerous. In the long term you
have to be prepared for the deprecated functionality. You get rid of
the warning my setting explicit_defaults_for_timestamp = 1 in your
my.cnf [mysqld] section.
You can find the my.cnf
file in the following locations, and in
this order the values override each other:
- /etc/my.cnf
- /etc/mysql/my.cnf
- $MYSQL_HOME/my.cnf
- [datadir]/my.cnf
- ~/.my.cnf
You can also find your file by
find / -name my.cnf
I added the following in /etc/mysql/my.cnf
[mysqld]
explicit_defaults_for_timestamp = 1
Now try
mysqld --initialize
And I got a reduced error without Timestamp stuff
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2018-11-12T20:13:45.024116Z 0 [ERROR] Aborting
Is this good? Not sure so I look deeper. According to the aboveaccepted stack
answer for the error you need to
sudo -i #log into root
cd /var/lib/mysql
rm -r *
su username # get back to the original user
mysqld --initialize
This, still gave me the exact same error. No change!
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2018-11-12T20:13:45.024116Z 0 [ERROR] Aborting
I am not sure the above accepted answer helped at all with the removing the
/var/lib/mysql
, but sudo
helped:
sudo mysqld --initialize
worked... No error at all!
add a comment |
up vote
0
down vote
up vote
0
down vote
This is the entire solution for your problem.
According to fromdual, the suggestion is to just follow the
advice of the error. Some functionality is being deprecated.
Our advice is to enable the variable explicit_defaults_for_timestamp
now on your testing systems so you can see if your application behave
well and then you are prepared for the next release when this feature
will become the default.
In short term this warning is NOT dangerous. In the long term you
have to be prepared for the deprecated functionality. You get rid of
the warning my setting explicit_defaults_for_timestamp = 1 in your
my.cnf [mysqld] section.
You can find the my.cnf
file in the following locations, and in
this order the values override each other:
- /etc/my.cnf
- /etc/mysql/my.cnf
- $MYSQL_HOME/my.cnf
- [datadir]/my.cnf
- ~/.my.cnf
You can also find your file by
find / -name my.cnf
I added the following in /etc/mysql/my.cnf
[mysqld]
explicit_defaults_for_timestamp = 1
Now try
mysqld --initialize
And I got a reduced error without Timestamp stuff
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2018-11-12T20:13:45.024116Z 0 [ERROR] Aborting
Is this good? Not sure so I look deeper. According to the aboveaccepted stack
answer for the error you need to
sudo -i #log into root
cd /var/lib/mysql
rm -r *
su username # get back to the original user
mysqld --initialize
This, still gave me the exact same error. No change!
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2018-11-12T20:13:45.024116Z 0 [ERROR] Aborting
I am not sure the above accepted answer helped at all with the removing the
/var/lib/mysql
, but sudo
helped:
sudo mysqld --initialize
worked... No error at all!
This is the entire solution for your problem.
According to fromdual, the suggestion is to just follow the
advice of the error. Some functionality is being deprecated.
Our advice is to enable the variable explicit_defaults_for_timestamp
now on your testing systems so you can see if your application behave
well and then you are prepared for the next release when this feature
will become the default.
In short term this warning is NOT dangerous. In the long term you
have to be prepared for the deprecated functionality. You get rid of
the warning my setting explicit_defaults_for_timestamp = 1 in your
my.cnf [mysqld] section.
You can find the my.cnf
file in the following locations, and in
this order the values override each other:
- /etc/my.cnf
- /etc/mysql/my.cnf
- $MYSQL_HOME/my.cnf
- [datadir]/my.cnf
- ~/.my.cnf
You can also find your file by
find / -name my.cnf
I added the following in /etc/mysql/my.cnf
[mysqld]
explicit_defaults_for_timestamp = 1
Now try
mysqld --initialize
And I got a reduced error without Timestamp stuff
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2018-11-12T20:13:45.024116Z 0 [ERROR] Aborting
Is this good? Not sure so I look deeper. According to the aboveaccepted stack
answer for the error you need to
sudo -i #log into root
cd /var/lib/mysql
rm -r *
su username # get back to the original user
mysqld --initialize
This, still gave me the exact same error. No change!
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2018-11-12T20:13:45.024116Z 0 [ERROR] Aborting
I am not sure the above accepted answer helped at all with the removing the
/var/lib/mysql
, but sudo
helped:
sudo mysqld --initialize
worked... No error at all!
answered Nov 12 at 20:50
Thej Kiran
4110
4110
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f797670%2fhow-to-create-a-database-directory-structure-for-mysql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown