Running Mysql as root

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

user=root 

      

line in my.cnf Since I want the test server to update to the production server, I would like to comment out this line and restart.

Are there any side effects? expected data loss?

+2


source to share


4 answers


the first step is to back up the data directory.

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



this is a fairly secure operation and may result in loss of functionality or data. but just in case you have a backup!

+1


source


The root user for MySQL is NOT the same as the root user for logging into the computer, so there shouldn't be any side effects if you grant mysql user rights on the production server.

This is the user mentioned in

$ mysql -u user -p password db_name

      



who could share the name with a user logged into the computer, but shouldn't.

EDIT: please note - a normal user can run mysql as root if the correct password is used in the command above. It won't be the same as root password if you know what I mean.

If this is not clear, you should definitely familiarize yourself with the meaning of "root" in the context of MySQL.

+2


source


  • When you start your mysql shell, enter it as root as

    C: \ xampp \ mysql \ bin \ mysql.exe -u root -p [password, if any];

  • If you don't enter a password after the '-p' in the command, it will prompt you for one. Just hit enter if you don't have a password (default) or enter a password if you've set one.

  • to check if you have a password or not, got to http://localhost/phpmyadmin/

    • you can find the credentials of the root user.
  • Once you connect, just check all databases as SHOW DATABASES; you will get a list of already existing default databases. This will be the final confirmation.

+1


source


To log into MySQL as root, all I had to do was:

mysql -u root

      

+1


source







All Articles