Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root

MysqlSqlmy.cnf

Mysql Problem Overview


I am not sure how to fix this:

dyn-72-33-214-45:python mona$ sudo /usr/local/mysql/bin/mysqld stop
2014-09-06 09:49:04 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-09-06 09:49:04 22992 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.6.15-osx10.7-x86_64/data/ is case insensitive
2014-09-06 09:49:04 22992 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2014-09-06 09:49:04 22992 [ERROR] Aborting

2014-09-06 09:49:04 22992 [Note] Binlog end
2014-09-06 09:49:04 22992 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

Mysql Solutions


Solution 1 - Mysql

I'm using OS X (Yosemite) and this error happened to me when I upgraded from Mavericks to Yosemite. It was solved by using this command

sudo /usr/local/mysql/support-files/mysql.server start

Solution 2 - Mysql

you might try this if you logged in with root:

mysqld --user=root

Solution 3 - Mysql

The MySQL daemon should not be executed as the system user root which (normally) do not has any restrictions.

According to your cli, I suppose you wanted to execute the initscript instead:

sudo /etc/init.d/mysql stop

Another way would be to use the mysqladmin tool (note, root is the MySQL root user here, not the system root user):

/usr/local/mysql/bin/mysqladmin --port=8889 -u root shutdown

Solution 4 - Mysql

Try this for Amazon Linux AMI or for centOS

sudo service mysqld restart

Solution 5 - Mysql

How i resolved this was following the 4th point in this url: https://dev.mysql.com/doc/refman/8.0/en/changing-mysql-user.html

  1. Edit my.cnf
  2. Add user = root under under [mysqld] group of the file

If this doesn't work then make sure you have changed the password from default.

Solution 6 - Mysql

I also had the same problem and able to resolve after using below command

/root/mysql-sandboxes/3320/bin/mysqld --defaults-file=/root/mysql-sandboxes/3320/my.cnf  --user=root &

Solution 7 - Mysql

osx could be using launchctl to launch mysql. Try this:

sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist

Solution 8 - Mysql

Donal had the right solution for me. However, the updated plist name for 2017 is

com.oracle.oss.mysql.mysqld.plist.

Solution 9 - Mysql

in my case (RHEL7 and MariaDB) this works.

sudo systemctl restart mariadb

Solution 10 - Mysql

On top of @mise's answer, After I installed MacOS Mojave, I also had to change files ownership on all my MAMP directory and contents).

From the Finder, I went in Application/MAMP, showed files info (cmd + i) and in permissions section added myself with read & write perms, then from the little gear applied to all the children.

Solution 11 - Mysql

The correct answer that worked for me on CentOS is

/etc/init.d/mysql restart

which is an init script and not /etc/init.d/mysqld restart, which is binary

The is in fact comment of @MrTux on the question which worked for me. It took quite a bit of my time hence posting it as answer.

Solution 12 - Mysql

to run mysqld as root user from command line you need to add the switch/options --user=root

mariadb run as system root user

Solution 13 - Mysql

I had this issue while running MySQL on Minikube (Ubuntu box) and I solved it with:

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld

Solution 14 - Mysql

Very weird, but I got this error when I made a typo in the my.cnf file.
So it had nothing to do with the user directive not defined or not running as root-user.

My mistake was:

bind=192.168.1.2

instead of

bind-address=192.168.1.2

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMona JalalView Question on Stackoverflow
Solution 1 - MysqlMiseView Answer on Stackoverflow
Solution 2 - MysqlxiaojueguanView Answer on Stackoverflow
Solution 3 - MysqlMrTuxView Answer on Stackoverflow
Solution 4 - MysqlSaurabh Chandra PatelView Answer on Stackoverflow
Solution 5 - MysqlmondreyView Answer on Stackoverflow
Solution 6 - MysqlHasithaView Answer on Stackoverflow
Solution 7 - MysqlDonalView Answer on Stackoverflow
Solution 8 - MysqlAndy StutzmanView Answer on Stackoverflow
Solution 9 - MysqlLeo MagoView Answer on Stackoverflow
Solution 10 - MysqlantoniView Answer on Stackoverflow
Solution 11 - MysqlHammad KhanView Answer on Stackoverflow
Solution 12 - MysqlPeterView Answer on Stackoverflow
Solution 13 - MysqlIvan BosnicView Answer on Stackoverflow
Solution 14 - MysqlTimView Answer on Stackoverflow