On Windows, you can run the server as a Windows service using a normal user account.
On Unix, the MySQL server mysqld can be started
and run by any user. However, you should avoid running the server
as the Unix
root user for security reasons. To
change mysqld to run as a normal unprivileged
user_name, you must do the
Stop the server if it is running (use mysqladmin shutdown).
Change the database directories and files so that
user_namehas privileges to read and write files in them (you might need to do this as the Unix
If you do not do this, the server will not be able to access databases or tables when it runs as
If directories or files within the MySQL data directory are symbolic links,
chown -Rmight not follow symbolic links for you. If it does not, you will also need to follow those links and change the directories and files they point to.
Start the server as user
user_name. Another alternative is to start mysqld as the Unix
rootuser and use the
--user=option. mysqld starts up, then switches to run as the Unix user
user_namebefore accepting any connections.
To start the server as the given user automatically at system startup time, specify the user name by adding a
useroption to the
[mysqld]group of the
/etc/my.cnfoption file or the
my.cnfoption file in the server's data directory. For example:
If your Unix machine itself is not secured, you should assign
passwords to the MySQL
root accounts in the
grant tables. Otherwise, any user with a login account on that
machine can run the mysql client with a
--user=root option and perform any
operation. (It is a good idea to assign passwords to MySQL
accounts in any case, but especially so when other login accounts
exist on the server host.) See
Section 3.4, “Securing the Initial MySQL Accounts”.