博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux mysql安装
阅读量:6248 次
发布时间:2019-06-22

本文共 4252 字,大约阅读时间需要 14 分钟。

hot3.png

1.下载:

 mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz并解压

2.安装  yum search libaio

yum search libaio yum install libaio

3.增加用户何用户组

groupadd mysqluseradd -r -g mysql -s /bin/false mysql

4.mysql初始化

[root@localhost mysql]# bin/mysqld --initialize --user=mysql2019-03-27T03:50:57.227514Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2019-03-27T03:50:57.433350Z 0 [Warning] InnoDB: New log files created, LSN=457902019-03-27T03:50:57.478308Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2019-03-27T03:50:57.535988Z 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: 8759eef1-5043-11e9-8123-000c29b1e7cf.2019-03-27T03:50:57.537098Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.2019-03-27T03:50:57.538588Z 1 [Note] A temporary password is generated for root@localhost: G.vlOFW7m+8d

5.安装附加协议

bin/mysql_ssl_rsa_setupGenerating a 2048 bit RSA private key...............+++.......................................................................+++writing new private key to 'ca-key.pem'-----Generating a 2048 bit RSA private key...+++.................................................................+++writing new private key to 'server-key.pem'-----Generating a 2048 bit RSA private key....................+++...+++writing new private key to 'client-key.pem'-----

6.mysql启动

[root@localhost mysql]# bin/mysqld_safe --user=mysql&[1] 80177[root@localhost mysql]# Logging to '/usr/local/mysql/data/localhost.localdomain.err'.2019-03-27T03:54:09.318834Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

7.拷贝启动命令文件到启动项目

cp -a support-files/mysql.server /etc/init.d/mysql.server

此时 ,可以通过如下代码操作

[root@localhost mysql]# service mysql.server statusUsage: mysql.server  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]

8.添加mysql命令全局可用

ln -s /usr/local/mysql/bin/mysql /usr/bin/

9.登入mysql,密码为步骤4最后显示的字符

mysql -u root -p

此时无法进行sql执行,需要重新更改默认root密码才能操作

10.关闭mysql,并以跳过验证模式启动

[root@localhost mysql]# service mysql.server stop Shutting down MySQL.. SUCCESS! [root@localhost mysql]# mysqld_safe --skip-grant-tables &[1] 96772[root@localhost mysql]# 2019-03-27T05:38:04.193707Z mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.

此时登陆root账户 ,无需密码,同时修改密码个刷新配置。

[root@localhost mysql]# mysql -u root Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.25 MySQL Community Server (GPL)..........mysql> update user set authentication_string=password('1234'),password_expired='N' where user='root';Query OK, 1 row affected, 1 warning (0.00 sec)Rows matched: 1  Changed: 1  Warnings: 1mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)

11.关闭当前mysql,以正常模式启动mysql,即可通过设定密码使用

[root@localhost mysql]# service mysql.server stopShutting down MySQL..2019-03-27T05:52:35.767193Z mysqld_safe mysqld from pid file /usr/local/mysql/data/localhost.localdomain.pid ended SUCCESS! [1]+  Done                    mysqld_safe --skip-grant-tables[root@localhost mysql]# mysqld_safe --user=mysql &[1] 117801[root@localhost mysql]# 2019-03-27T05:52:40.700667Z mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.2019-03-27T05:52:40.745950Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data[root@localhost mysql]# mysql -u root -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.25 MySQL Community Server (GPL)Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema || sys                |+--------------------+4 rows in set (0.00 sec)

到此,简单的搭建完成

转载于:https://my.oschina.net/AHdaibo/blog/3028585

你可能感兴趣的文章
一份关于jvm内存调优及原理的学习笔记
查看>>
怎么查看80端口占用情况- 如何查看端口占用情况?
查看>>
搭建测试框架
查看>>
position:absolute在IE8浏览器下无法显示正确位置
查看>>
过滤器与拦截器区别
查看>>
C# 使用 Windows API 发送文件到打印机
查看>>
NOIP2013 D1T3 货车运输 倍增LCA OR 并查集按秩合并
查看>>
80端口被NT kernel & System 占用pid 4
查看>>
mat工具MemoryAnalyzer进行分析java内存溢出hprof文件
查看>>
完整性约束
查看>>
Django之restframework
查看>>
P3924 康娜的线段树
查看>>
Vue的安装和语法
查看>>
验证表单必须为数字并且只保留小数点后2位
查看>>
2-sat基础题 uvalive 3211
查看>>
Elasticsearch5.2.0部署过程的坑
查看>>
go build 不同系统下的可执行文件
查看>>
浏览器版本信息判断整理
查看>>
【我的Android进阶之旅】解决Android Studio 运行gradle命令时报错: 错误: 编码GBK的不可映射字符...
查看>>
windows 下解决 Time_Wait 和 CLOSE_WAIT 方法
查看>>