Centos 7 安装mysql5.7.24二进制 版本的方法及解决办法
16lz
2021-12-25
Mysql 二进制安装方法
下载mysql
https://dev.mysql.com/downloads/mysql/
1.解压包
tar xf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.24-linux-glibc2.12-x86_64 /usr/local/mysql5.7
groupadd mysql
opt]# useradd -r -g mysql mysql
chown -R mysql:mysql mysql5.7
Cd /home/usr/local/mysql5.6/mkdir datamkdir logchown -R mysql:mysql mysql5.7
./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql5.7/ --datadir=/usr/local/mysql5.7/data/
cp mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqld
vi /etc/init.d/mysqldbasedir= /usr/local/mysql5.7datadir= /usr/local/mysql5.7/data
8.增加环境变量 (最下面添加)l
vi /etc/profileexport MYSQL_HOME=" /usr/local/mysql5.7"export PATH="$PATH:$MYSQL_HOME/bin"
source /etc/profile
vi /etc/my.cnf[client]port=3306[mysqld]basedir=/usr/local/mysql5.7datadir=/usr/local/mysql5.7/data#socket=/usr/local/mysql5.7/mysql.socksocket=/tmp/mysql.sockuser=mysql#skip-grant-tables# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Settings user and group are ignored when systemd is used.# If you need to run mysqld under a different user or group,# customize your systemd unit file for mariadb according to the# instructions in http://fedoraproject.org/wiki/Systemd[mysqld_safe]log-error=/usr/local/mysql5.7/log/mysqld.logpid-file=/usr/local/mysql5.7/data/mysqld.pid## include all files from the config directory#!includedir /etc/my.cnf.d
chkconfig --add mysqld chkconfig mysqld on
service mysqld start netstat -anpt
2018-11-02T02:07:44.574468Z 1 [Note] A temporary password is generated for root@localhost: lXyB0%fi#9-S (这个就是密码)mysql> help contentsERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.mysql> help contentsERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.mysql> show databases;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决办法
1、 修改用户密码
mysql> alter user 'root'@'localhost' identified by 'youpassword';
mysql> set password=password("youpassword");
mysql> flush privileges;mysql> help contents
更多相关文章
- 'xlargeScreens' in package 'android'
- Android(安卓)版本兼容 — Android(安卓)6.0 和 7.0后获取Mac地
- android“设置”里的版本号
- Android(安卓)version and Linux Kernel version
- opengrok setup on ubuntu for android source code browser
- Android——开发环境
- android通过ksoap2对webservice的解析
- Android如何获得系统版本
- Android,一个思路实现APP版本更新