[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
#By default we only accept connections from localhost
bind-address = 127.0.0.1
#Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character_set_server = utf8
init_connect = 'SET NAMES utf8'
在[mysqld]下面增加一行skip-grant-tables,配置如下
[mysqld]
skip-grant-tables
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
#By default we only accept connections from localhost
bind-address = 127.0.0.1
#Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character_set_server = utf8
init_connect = 'SET NAMES utf8'
保存后重启mysql
su root
service mysql restart
mysql -uroot
3.重新给root用户权限
use mysql
update user set Update_priv ='Y' where user ='root';
update user set Select_priv ='Y' where user = 'root';
update user set Insert_priv ='Y' where user = 'root';
set password for root@'%' = password('root');
Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. # This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the Free Software Foundation. # This program is also distributed with certain software (including but not limited to OpenSSL) that is licensed under separate terms, as designated in a particular file or component or in included license documentation. The authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the separately licensed software that they have included with MySQL. # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, for more details. # You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA !includedir /etc/mysql/conf.d/ !includedir /etc/mysql/mysql.conf.d/
近期评论