[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost ~]# service mysqld  stop
停止 mysqld:                                              [确定]
[root@localhost ~]# mysqld_safe --user=root --skip-grant-tables --skip-networking & 
[1] 15810
[root@localhost ~]# 2017-05-08T08:39:32.110455Z mysqld_safe Logging to '/var/log/mysqld.log'.
2017-05-08T08:39:32.444070Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2017-05-08T08:39:33.128859Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

解决方案 »

  1.   

     service mysqld  stop有时候关不掉
    用ps检查下是不是没关成功
    另外启动出错应该去/var/log下看看日志信息
      

  2.   

    看看日志中写了什么 '/var/log/mysqld.log
      

  3.   

    报这个错误
    2017-05-06T06:34:45.984704Z 0 [Note] Plugin 'FEDERATED' is disabled.
    2017-05-06T06:34:46.406576Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170506 14:34:46
    2017-05-06T06:34:46.447198Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
      

  4.   

    用ps出现这么一大堆  没启动成功吧  
    [root@localhost ~]# ps -ef |grep mysql
    mysql     2205     1  0 May08 ?        00:00:00 /usr/bin/gnome-keyring-daemon --daemonize --login
    mysql     2215  2020  0 May08 ?        00:00:00 gnome-session
    mysql     2223     1  0 May08 ?        00:00:00 dbus-launch --sh-syntax --exit-with-session
    mysql     2224     1  0 May08 ?        00:00:00 /bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
    mysql     2288     1  0 May08 ?        00:00:01 /usr/libexec/gconfd-2
    mysql     2293     1  0 May08 ?        00:00:07 /usr/libexec/gnome-settings-daemon
    mysql     2301     1  0 May08 ?        00:00:00 /usr/libexec/gvfsd
    mysql     2308     1  0 May08 ?        00:00:00 seahorse-daemon
    mysql     2310  2215  0 May08 ?        00:00:01 metacity
    mysql     2315     1  0 May08 ?        00:00:01 /usr/bin/pulseaudio --start --log-target=syslog
    mysql     2316  2215  0 May08 ?        00:00:04 gnome-panel
    mysql     2321  2315  0 May08 ?        00:00:00 /usr/libexec/pulse/gconf-helper
    mysql     2331  2215  0 May08 ?        00:00:28 nautilus
    mysql     2333     1  0 May08 ?        00:00:00 /usr/libexec/bonobo-activation-server --ac-activate --ior-output-fd=18
    mysql     2344     1  0 May08 ?        00:00:00 /usr/libexec/gvfs-gdu-volume-monitor
    mysql     2345     1  0 May08 ?        00:00:00 /usr/libexec/wnck-applet --oaf-activate-iid=OAFIID:GNOME_Wncklet_Factory --oaf-ior-fd=18
    mysql     2346     1  0 May08 ?        00:00:00 /usr/libexec/trashapplet --oaf-activate-iid=OAFIID:GNOME_Panel_TrashApplet_Factory --oaf-ior-fd=24
    mysql     2350     1  0 May08 ?        00:00:00 /usr/libexec/gvfsd-trash --spawner :1.7 /org/gtk/gvfs/exec_spaw/0
    mysql     2354  2215  0 May08 ?        00:00:00 /usr/libexec/evolution/2.32/evolution-alarm-notify
    mysql     2362  2215  0 May08 ?        00:00:00 gnome-power-manager
    mysql     2364  2215  0 May08 ?        00:00:00 /usr/libexec/polkit-gnome-authentication-agent-1
    mysql     2366  2215  0 May08 ?        00:00:00 bluetooth-applet
    mysql     2367  2215  0 May08 ?        00:00:00 /usr/libexec/gdu-notification-daemon
    mysql     2369  2215  0 May08 ?        00:00:00 gnome-volume-control-applet
    mysql     2372  2215  0 May08 ?        00:00:00 /usr/sbin/restorecond -u
    mysql     2377  2215  0 May08 ?        00:00:00 gpk-update-icon
    mysql     2378  2215  0 May08 ?        00:00:00 abrt-applet
    mysql     2379  2215  0 May08 ?        00:00:02 python /usr/share/system-config-printer/applet.py
    mysql     2380  2215  0 May08 ?        00:00:01 nm-applet --sm-disable
    mysql     2382     1  0 May08 ?        00:00:00 /usr/libexec/gvfs-gphoto2-volume-monitor
    mysql     2385     1  0 May08 ?        00:00:00 /usr/libexec/im-settings-daemon
    mysql     2387     1  0 May08 ?        00:00:06 /usr/libexec/gvfs-afc-volume-monitor
    mysql     2437     1  0 May08 ?        00:00:00 /usr/libexec/gdm-user-switch-applet --oaf-activate-iid=OAFIID:GNOME_FastUserSwitchApplet_Factory --oaf-ior-fd=28
    mysql     2441     1  0 May08 ?        00:00:02 /usr/libexec/clock-applet --oaf-activate-iid=OAFIID:GNOME_ClockApplet_Factory --oaf-ior-fd=31
    mysql     2444     1  0 May08 ?        00:00:01 /usr/bin/gnote --panel-applet --oaf-activate-iid=OAFIID:GnoteApplet_Factory --oaf-ior-fd=22
    mysql     2445     1  0 May08 ?        00:00:00 /usr/libexec/notification-area-applet --oaf-activate-iid=OAFIID:GNOME_NotificationAreaApplet_Factory --oaf-ior-fd=34
    mysql     2446     1  0 May08 ?        00:00:04 gnome-screensaver
    mysql     2507     1  0 May08 ?        00:00:00 /usr/libexec/gvfsd-burn --spawner :1.7 /org/gtk/gvfs/exec_spaw/1
    mysql     2590  2385  0 May08 ?        00:00:00 /usr/bin/ibus-daemon -r --xim
    mysql     2593     1  0 May08 ?        00:00:00 /usr/libexec/gconf-im-settings-daemon
    mysql     2594  2590  0 May08 ?        00:00:00 /usr/libexec/ibus-gconf
    mysql     2596  2590  0 May08 ?        00:00:02 python /usr/share/ibus/ui/gtk/main.py
    mysql     2598     1  0 May08 ?        00:00:00 /usr/libexec/ibus-x11 --kill-daemon
    mysql     2599  2590  0 May08 ?        00:00:00 /usr/libexec/ibus-engine-pinyin --ibus
    mysql     3573     1  0 05:48 ?        00:00:01 /usr/bin/gnome-terminal -x /bin/sh -c cd '/home/mysql/桌面' && exec $SHELL
    mysql     3574  3573  0 05:48 ?        00:00:00 gnome-pty-helper
    mysql     3575  3573  0 05:48 pts/0    00:00:00 /bin/bash
    root      4307  3651  0 06:17 pts/2    00:00:00 less /var/log/mysqld.log
    root      4370  3651  0 06:21 pts/2    00:00:00 grep mysql