ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

Linux 上面安装mysql5.7.28

2019-11-07 14:57:09  阅读:75  来源: 互联网

标签:root mysql5.7 Linux 28 50 usr mysql local localhost



1.下载msyql安装包 

 

 2.通过软件把压缩包上传到linux上面去

 

 3.把压缩包解压后,重命名

mv mysql..........(文件夹的名字) mysql

4.把msyql 放到 /usr/loca下

cp -r mysql /usr/local

5.在mysql下添加data目录

[root@localhost ~]# mkdir /usr/local/mysql/data

6.更改mysql目录下所有的目录及文件夹所属组合用户

 
[root@localhost /]# cd /usr/local/ 
[root@localhost local]# chown -R mysql:mysql mysql/
[root@localhost local]# chmod -R 755 mysql/

7.编译安装并初始化mysql,记住命令行末尾的密码:

[root@localhost local]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
2017-08-31T08:50:23.910440Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-08-31T08:50:23.910635Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/--datadir=/usr/local/mysql/data/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' con
figuration directive.2017-08-31T08:50:24.709286Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-08-31T08:50:24.767540Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-08-31T08:50:24.892629Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6e083b8f-8e29-11e7-88b1-
005056b427be.2017-08-31T08:50:24.895674Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-08-31T08:50:24.896645Z 1 [Note] A temporary password is generated for root@localhost: gFamcspKm2+u

8.启动mysql服务

[root@localhost local]# /usr/local/mysql/support-files/mysql.server start

9.做个软链接,重启服务

[root@localhost local]# ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql 
[root@localhost local]# service mysql restart
Shutting down MySQL.. SUCCESS! 
Starting MySQL. SUCCESS!

10.做个软链接,将安装目录下的mysql 放在/usr/bin 目录下

[root@localhost local]# ln -s /usr/local/mysql/bin/mysql /usr/bin

11.登录msyql,输入密码(密码为步骤7初始化生成的密码)

[root@localhost local]# mysql -u root -p
Enter password:

12.修改密码并开放远程

msql>alter user 'root'@'localhost' identified by '123456';
mysql>use mysql;
msyql>update user set user.Host='%' where user.User='root';
mysql>flush privileges;
mysql>quit

13.编辑my.cnf,添加配置文件,配置内容为

[root@localhost local]# vi /usr/local/mysql/my.cnf
[mysqld]
port = 3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

  

  

 



标签:root,mysql5.7,Linux,28,50,usr,mysql,local,localhost
来源: https://www.cnblogs.com/huoyufei/p/11811976.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有