inicie el servidor MySQL desde la línea de comandos en Mac OS Lion


Instalé MySQL para mi Mac. Además de iniciar el servidor SQL con MySQL.Herramienta prefPane instalado en la preferencia del sistema, quiero saber la instrucción para comenzar desde la línea de comandos. Hago lo siguiente:

Después de

Su root

Inicio el servidor MySQL por línea de comandos, produce un error como se muestra a continuación:

Sh-3.2 # /usr/local/mysql/bin/mysqld

111028 16:57:43 [Warning] Setting lower_case_table_names = 2 because sistema de archivos para/usr/local / mysql-5.5.17-osx10. 6-x86_64 / data / es el caso insensible

111028 16:57:43 [Error] Error fatal: Por favor, lea la sección "Seguridad" de el manual para averiguar cómo ejecutar mysqld como root!

111028 16:57:43 [ERROR] Abortando

111028 16:57:43 [Nota] / usr / local/mysql/bin / mysqld: Shutdown complete

Por favor, ayúdame!

EDITAR:

La razón está aquí: http://dev.mysql.com/doc/refman/5.5/en/changing-mysql-user.html

Una solución se describe en la respuesta de xdazz a continuación.

Author: Anthony, 2011-10-28

12 answers

Intenta /usr/local/mysql/bin/mysqld_safe

Ejemplo:

shell> sudo /usr/local/mysql/bin/mysqld_safe
(Enter your password, if necessary)
(Press Control-Z)
shell> bg
(Press Control-D or enter "exit" to exit the shell)

También puede agregar estos a sus scripts de inicio de bash:

export MYSQL_HOME=/usr/local/mysql
alias start_mysql='sudo $MYSQL_HOME/bin/mysqld_safe &'
alias stop_mysql='sudo $MYSQL_HOME/bin/mysqladmin shutdown'
 179
Author: xdazz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-11-20 21:36:58

Simplemente:

mysql.server start

mysql.server stop

mysql.server restart

 141
Author: user2792249,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-12-15 04:14:10

También me gustan los alias ... sin embargo, he tenido problemas con MySQLCOM para comenzar ... falla silenciosamente ... Mi solución es similar a las otras ... ~/.bash_aliases

alias mysqlstart='sudo /usr/local/mysql/support-files/mysql.server start'
alias mysqlstop='sudo /usr/local/mysql/support-files/mysql.server stop' 
 132
Author: Eddie B,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-14 02:54:34

Como este útil artículo establece: En OS X para iniciar / detener MySQL desde la línea de comandos:

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

En Linux iniciar / detener desde la línea de comandos:

/etc/init.d/mysqld start 
/etc/init.d/mysqld stop 
/etc/init.d/mysqld restart 

Algunos sabores de Linux también ofrecen el comando de servicio

# service mysqld start 
# service mysqld stop 
# service mysqld restart

O

 # service mysql start 
 # service mysql stop 
 # service mysql restart 
 78
Author: David,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-13 17:17:58

Si lo instalaste con homebrew, el binario estará en algún lugar como

/usr/local/Cellar/mysql/5.6.10/bin/mysqld

Lo que significa que puedes iniciarlo con

/usr/local/Cellar/mysql/5.6.10/support-files/mysql.server start

Y para con

/usr/local/Cellar/mysql/5.6.10/support-files/mysql.server stop

Editar: Como Jacob Raccuia mencionó, asegúrese de poner la versión apropiada de MySQL en la ruta.

 65
Author: Alex K,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-08-13 19:00:02
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop

Hacer alias en .bash_profile

alias start_mysql="/Library/StartupItems/MySQLCOM/MySQLCOM start"
alias stop_mysql="/Library/StartupItems/MySQLCOM/MySQLCOM stop"

Y si está intentando ejecutar como root, use el siguiente modo seguro

sudo ./bin/mysqld_safe

Si todavía tiene problemas para comenzar, una lectura recomendada: servidor mysql5.58 unstart en mac os 10.6.5

 31
Author: Dennis,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 12:10:54

Tal vez su servidor mysql no se inició

Puedes probar

/usr/local/bin/mysql.inicio del servidor

 27
Author: 42wolf,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-09 15:15:35

Si está instalado con homebrew intente simplemente escribir mysql.server en terminal y eso debería ser todo. AFAIK it ejecutable estará bajo/usr/local/bin / mysql.servidor.

Si no, siempre puede ejecutar el siguiente "localizar mysql.servidor " que le dirá dónde encontrar tal fichero.

 8
Author: Nevio Vesić,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-08-26 11:45:28

Si tienes MySQL instalado a través de Homebrew estos comandos te ayudarán:

# For starting
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

# For stoping
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
 5
Author: Mario Uher,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-08-13 09:19:23

Mi MySQL se instala a través de homebrew en OS X ElCaptain. ¿Qué arregló que se estaba ejecutando

brew doctor

  • lo que sugiere que corro

sudo chown -R $(whoami):admin /usr/local

Entonces:

brew update
mysql.server start

Mysql se está ejecutando ahora

 4
Author: Merhawi Fissehaye,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-10 11:27:21

Para mí esta solución funcionó en mac Sierra OS:

sudo /usr/local/bin/mysql.server start
Starting MySQL
SUCCESS!
 3
Author: shacharsol,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-12 14:16:47
111028 16:57:43 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

¿Ha establecido una contraseña de root para su instalación de mysql? Esto es diferente a tu contraseña de root sudo. Try /usr/local/mysql/bin/mysql_secure_installation

 0
Author: Hoppo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-10-30 09:00:39