mysql5.7 二进制包安装
时间:2021-07-01 10:21:17
帮助过:4人阅读
wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz2. 解压 tar xxvf mysql-5.7.12-linux-glibc2.5-x86_64.tar.gzmv mysql-5.7.12-linux-glibc2.5-x86_64 /usr/local/mysql3. 初始化useradd -M -s /sbin/nologin mysql mkdir -p /data/mysqlchown mysql /data/mysqlcd /usr/local/mysql./bin/mysqld --initialize --user=mysql --datadir=/data/mysql注意,这一步最后一行会有一个提示[Note] A temporary password is generated for root@localhost: B*s1i(*,kXwg最后面的字符串为root密码。./bin/mysql_ssl_rsa_setup --datadir=/data/mysql4. 拷贝配置文件和启动脚本cp support-files/my-default.cnf /etc/my.cnf vim /etc/my.cnf //编辑或者修改basedir = /usr/local/mysqldatadir = /data/mysqlport = 3306socket = /tmp/mysql.sockcp support-files/mysql.server /etc/init.d/mysqldvi /etc/init.d/mysqld //编辑或者修改basedir=/usr/local/mysqldatadir=/data/mysql5. 启动服务/etc/init.d/mysqld start6. 设置root密码使用初始化密码登录/usr/local/mysql/bin/mysql -uroot -p‘B*s1i(*,kXwg‘ //进入后直接设置密码mysql>set password = password(‘mypass‘); //一定要设置一下新密码退出来,再使用新的密码登录就可以了还有一种情况,就是不知道初始化密码vi /etc/my.cnf在[mysqld]下面增加一行skip-grant-tables重启 /etc/init.d/mysqld restart/usr/local/mysql/bin/mysql -uroot mysql> update user set authentication_string=password(‘123333‘) where user=‘root‘;退出来后,更改my.cnf,去掉刚加的 skip-grant-tables重启 /etc/init.d/mysqld restart
mysql5.7 二进制包安装
标签:mysql