DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info.gz) Changing MySQL user

Info Catalog (mysql.info.gz) Link errors (mysql.info.gz) Installation Issues (mysql.info.gz) File permissions
 
 A.3.2 How to Run MySQL as a Normal User
 ---------------------------------------
 
 On Windows, you can run the server as a Windows service using normal
 user accounts beginning with MySQL 4.0.17 and 4.1.2.  (Older MySQL
 versions required you to have administrator rights.  This was a bug
 introduced in MySQL 3.23.54.)
 
 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.  In order to change `mysqld' to run as a normal
 unprivileged Unix user USER_NAME, you must do the following:
 
   1. Stop the server if it's running (use `mysqladmin shutdown').
 
   2. Change the database directories and files so that USER_NAME has
      privileges to read and write files in them (you might need to do
      this as the Unix `root' user):
 
           shell> chown -R USER_NAME /PATH/TO/MYSQL/DATADIR
 
      If you do not do this, the server will not be able to access
      databases or tables when it runs as USER_NAME.
 
      If directories or files within the MySQL data directory are
      symbolic links, you'll also need to follow those links and change
      the directories and files they point to.  `chown -R' might not
      follow symbolic links for you.
 
   3. Start the server as user USER_NAME. If you are using MySQL 3.22 or
      later, another alternative is to start `mysqld' as the Unix `root'
      user and use the `--user=USER_NAME' option.  `mysqld' will start
      up, then switch to run as the Unix user USER_NAME before accepting
      any connections.
 
   4. To start the server as the given user automatically at system
      startup time, specify the username by adding a `user' option to
      the `[mysqld]' group of the `/etc/my.cnf' option file or the
      `my.cnf' option file in the server's data directory. For example:
 
           [mysqld]
           user=USER_NAME
 
 If your Unix machine itself isn't 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.)  
 Post-installation.
 
Info Catalog (mysql.info.gz) Link errors (mysql.info.gz) Installation Issues (mysql.info.gz) File permissions
automatically generated byinfo2html