MySQL5.7安装及新建密码

来源:互联网 发布:火狐javascript设置 编辑:程序博客网 时间:2024/06/06 18:51

我的安装环境为:centos6.7,mysql-5.7.13


1.确认防火墙和selinux关闭

2.检查是否存在mysql,存在则卸载

3.解压安装包,yum-y install

mysql-community-common-5.7.13-1.el6.x86_64.rpm

   mysql-community-libs-5.7.13-1.el6.x86_64.rpm--(依赖于common

      mysql-community-client-5.7.13-1.el6.x86_64.rpm--(依赖于libs

      mysql-community-server-5.7.13-1.el6.x86_64.rpm --(依赖于clientcommon

4.创建/www/data/mysql文件夹

5,编辑/etc/my.cnf,在[mysqld]后面修改datadir的位置。

6.mysql_install_db --datadir=/www/data/mysql

7.mysqld –initialize

8.vim /etc/my.cof   在[mysqld]后面添加skip-grant-tables保存

9./etc/init.d/mysqld restart

10.mysql -u root -p

11.user mysql

12.查看存在的账户信息

select host,user,authentication_string from mysql.user;

13.update mysql.user set authentication_string=password('*****') where user='root' and Host = 'localhost';

13.1.flush privileges;(似乎也不用这也不就可以生效)

14.exit;

15.改回来登录设置vim /etc/my.cof

在[mysqld]注释掉skip-grant-tables

保存

16./etc/init.d/mysqld restart

17.mysql -u root -p

18.可以通过

set PASSWORD = PASSWORD('s6R-qcmg');

重新设置密码





原创粉丝点击