1.安装mysql5.7
###如果下不下来,可以去官网用浏览器或迅雷下载后传到服务器上###
#wget https://repo.mysql.com//mysql57-community-release-el6-11.noarch.rpm#yum install mysql57-community-release-el6-11.noarch.rpm
#yum repolist enabled ? grep “mysql.-community.”
#yum install mysql-server mysql mysql-devel
2.mysqladmin设置root密码,无效
###启动mysql###
#service mysqld start#mysqladmin -u root password ‘123456’
###坑爹的报错开始了:##
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@’localhost’ (using password: NO)’
3.安全模式下进入设置密码
###停止mysql服务####
#service mysqld stop#mysqld_safe –skip-grant-tables &
###输入下面的命令按Enter###
mysql -uroot -p>use mysql;
3.1.之前版本的解决方案设置root密码
>update user set password=password(“mysql”) where user=’root’;
###又开始坑爹了,下面贴出报错信息###
ERROR 1054 (42S22): Unknown column ‘password’ in ‘field list’
3.2.最新mysql版本设置root密码的方法
###查看uesr表的字段,发现真的没有password这个字段###
>desc user \G;
###幸好看到了authentication_string(授权字符串)和password_expired(密码过期枚举),所以继续改,下面的语句不报错了###
>update user set authentication_string=password(‘123456’), password_expired=’N’ where user=”root”;
刷新权限并退出
>flush privileges;
>quit
重启mysql,用密码123456即可登录mysql
#service mysqld start
#mysql -u root -p
设置mysql开机启动
#chkconfig mysqld on
#chkconfig mysqld status
mysql远程登录授权
#mysql -u root -p
>GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘qiqi7179’ WITH GRANT OPTION;
>FLUSH PRIVILEGES;
>quit