Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting Mysql as root

Tags:

mysql

I have started mysql on my test server as a root. I have added

user=root 

line in my.cnf Since I want the test server to upgrade to production server, I will like to comment this line and restart.

Are there any side effects? data loss expected?

like image 959
shantanuo Avatar asked Jan 24 '23 05:01

shantanuo


2 Answers

The 'root' user for MySQL is NOT the same as the root user for logging in to the computer, so there should be no side effects provided you GRANT the appropriate rights to the mysql user on the production server.

That is the user mentioned in

$ mysql -u user -p password db_name

which could share a name with a user logged in to the computer, but doesn't have to.

EDIT: note - an ordinary user can start mysql as root if the correct password is used in the command above. This won't be the same as root's password, if you know what I mean.

If it's not clear you should definitely familiarise yourself with the meaning of 'root' in a MySQL context.

like image 147
pavium Avatar answered Jan 29 '23 09:01

pavium


first step would be to back up your data directory.

after you've done that, go ahead and make the change. just make sure that you have a user named mysql (or specify a different one explicitly) and that they have appropriate permissions to the data directory.

this is a pretty safe operation to do and should result in no loss of functionality or data. but just in case, you do have the backup!

like image 23
longneck Avatar answered Jan 29 '23 09:01

longneck