root用户密码忘记了,想通过mysql_safe修改,报如下错误:
[root@localhost /]# mysqld_safe –skip-grant-tables &
[1] 4493
[root@localhost /]# 150916 19:40:08 mysqld_safe Logging to '/home/mysql/data/localhost.localdomain.err'.
150916 19:40:08 mysqld_safe Starting mysqld daemon with databases from /home/mysql/data
150916 19:40:10 mysqld_safe mysqld from pid file /home/mysql/data/mysqld.pid ended
mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2)
[1]+  Done                    mysqld_safe –skip-grant-tables
[root@localhost /]# err文件内容:[root@localhost data]# vi localhost.localdomain.err 
150916 19:40:08 mysqld_safe Starting mysqld daemon with databases from /home/mysql/data
2015-09-16 19:40:08 0 [Warning] Using unique option prefix character_set_client instead of character-set-client-handshake is deprecated and will be removed in a future release. Please use the full name instead.
2015-09-16 19:40:08 0 [Warning] /home/mysql/bin/mysqld: ignoring option '--character-set-client-handshake' due to invalid value 'utf8'
2015-09-16 19:40:08 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-09-16 19:40:08 0 [Note] /home/mysql/bin/mysqld (mysqld 5.6.25) starting as process 4668 ...
2015-09-16 19:40:08 4668 [Note] Plugin 'FEDERATED' is disabled.
2015-09-16 19:40:08 4668 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-09-16 19:40:08 4668 [Note] InnoDB: The InnoDB memory heap is disabled
2015-09-16 19:40:08 4668 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-09-16 19:40:08 4668 [Note] InnoDB: Memory barrier is not used
2015-09-16 19:40:08 4668 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-09-16 19:40:08 4668 [Note] InnoDB: Not using CPU crc32 instructions
2015-09-16 19:40:08 4668 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-09-16 19:40:08 4668 [Note] InnoDB: Completed initialization of buffer pool
2015-09-16 19:40:08 4668 [Note] InnoDB: Highest supported file format is Barracuda.
2015-09-16 19:40:08 4668 [Note] InnoDB: 128 rollback segment(s) are active.
2015-09-16 19:40:08 4668 [Note] InnoDB: Waiting for purge to start
2015-09-16 19:40:08 4668 [Note] InnoDB: 5.6.25 started; log sequence number 1626077
/home/mysql/bin/mysqld: Too many arguments (first extra is '–skip-grant-tables').
Use --verbose --help to get a list of available options
2015-09-16 19:40:08 4668 [ERROR] Aborting2015-09-16 19:40:08 4668 [Note] Binlog end
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'partition'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_METRICS'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_CMPMEM'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_CMP'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_LOCKS'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'INNODB_TRX'
2015-09-16 19:40:08 4668 [Note] Shutting down plugin 'InnoDB'
2015-09-16 19:40:08 4668 [Note] InnoDB: FTS optimize thread exiting.
2015-09-16 19:40:08 4668 [Note] InnoDB: Starting shutdown...
2015-09-16 19:40:10 4668 [Note] InnoDB: Shutdown completed; log sequence number 1626087
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'ARCHIVE'
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'BLACKHOLE'
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'CSV'
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'MRG_MYISAM'
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'MEMORY'
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'MyISAM'
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'sha256_password'
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'mysql_old_password'
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'mysql_native_password'
2015-09-16 19:40:10 4668 [Note] Shutting down plugin 'binlog'
2015-09-16 19:40:10 4668 [Note] /home/mysql/bin/mysqld: Shutdown complete150916 19:40:10 mysqld_safe mysqld from pid file /e --verbose --help to get a list of available optionsome/mysql/data/mysqld.pid ended
在线求大神帮忙解决下。

解决方案 »

  1.   

    可以参考下这篇文章:http://blog.csdn.net/mchdba/article/details/459349815,修改用户密码5.1 使用mysqladmin命令来修改root用户的密码语法:mysqladmin -u -username -p password "new_password" 
    1
    新密码(new_password)必须用括号括起来,单引号会报错。
      

  2.   

    1.用root或者运行mysqld的用户登录系统;
    2.利用kill命令结束掉mysqld的进程;
    3.使用–skip-grant-tables参数启动MySQL Server
    #mysqld_safe –skip-grant-tables &
    4.然后用空密码方式使用root用户登录 MySQL;mysql -u root
    5.为root@localhost设置新密码
    mysql> update mysql.user set password=PASSWORD('新密码') where User='root'mysql> flush privileges;mysql> quit
    6. 重新启动MySQL
      

  3.   

    都错了
    #mysqld_safe –skip-grant-tables &
    应该是:
    #mysqld_safe --skip-grant-tables &