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

更多相关文章

  1. 'xlargeScreens' in package 'android'
  2. Android(安卓)版本兼容 — Android(安卓)6.0 和 7.0后获取Mac地
  3. android“设置”里的版本号
  4. Android(安卓)version and Linux Kernel version
  5. opengrok setup on ubuntu for android source code browser
  6. Android——开发环境
  7. android通过ksoap2对webservice的解析
  8. Android如何获得系统版本
  9. Android,一个思路实现APP版本更新

随机推荐

  1. 如何使用XSL来显示XML数据的详解
  2. 简单介绍XML技术概要
  3. 详解如何使用XMLHTTP发送超长XML表单数据
  4. 具体分析微软的xml解析器
  5. 使用XSL和ASP在线编辑XML文档的代码详解
  6. XmlHttp异步获取网站数据的代码案例分析
  7. xml中应用领域的示例代码分享
  8. 如何使用XMLHTTP制作域名查询系统的代码
  9. 详细介绍XML中名字空间的代码案例
  10. 使用用XML和XSL生成动态页面的代码详解