Rechercher dans le manuel MySQL
6.1.5 How to Run MySQL as a Normal User
On Windows, you can run the server as a Windows service using a normal user account.
On Linux, for installations performed using a MySQL repository or
RPM packages, the MySQL server mysqld should be
started by the local mysql
operating system
user. Starting by another operating system user is not supported
by the init scripts that are included as part of the MySQL
repositories.
On Unix (or Linux for installations performed using
tar.gz
packages) , 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 Unix
user user_name
, you must do the
following:
Stop the server if it is running (use mysqladmin shutdown).
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 Unixroot
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,
chown -R
might 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 Unixroot
user and use the--user=
option. mysqld starts up, then switches to run as the Unix useruser_name
user_name
before accepting any connections.To start the server as the given user automatically at system startup time, specify the user name by adding a
user
option to the[mysqld]
group of the/etc/my.cnf
option file or themy.cnf
option file in the server's data directory. For example:[mysqld] user=user_name
If your Unix machine itself is not secured, you should assign
passwords to the MySQL root
account 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 2.10.4, “Securing the Initial MySQL Account”.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-changing-mysql-user.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.