ubuntu18.04手动安装二进制MySQL8.0
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz
tar xvJf mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz
sudo mv mysql-8.0.13-linux-glibc2.12-x86_64 /var/mysql
然后新建一个文件/var/mysql/data_3306/my.cnf
:
[mysqld]
port=3306
datadir=/var/mysql/data_3306
log_error=/var/mysql/data_3306/error.log
basedir=/var/mysql
然后运行如下命令启动MySQL服务:
var/mysql/bin/mysqld --defaults-file=/var/mysql/data_3306/my.cnf --initialize --user=mysql
发现出错了,报错信息如下:
zifeiy@zifeiy-S1-Series:/var/mysql/data_3306$ cat error.log
2019-01-14T10:59:46.054629Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
2019-01-14T10:59:46.054690Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
2019-01-14T10:59:46.054946Z 0 [System] [MY-013169] [Server] /var/mysql/bin/mysqld (mysqld 8.0.13) initializing of server in progress as process 3621
2019-01-14T10:59:46.056585Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-01-14T10:59:46.056652Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /var/mysql/data_3306/ is unusable. You can safely remove it.
2019-01-14T10:59:46.056661Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-14T10:59:46.056743Z 0 [System] [MY-010910] [Server] /var/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.13) MySQL Community Server - GPL.
2019-01-14T11:02:07.365206Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
2019-01-14T11:02:07.365266Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
2019-01-14T11:02:07.365524Z 0 [System] [MY-013169] [Server] /var/mysql/bin/mysqld (mysqld 8.0.13) initializing of server in progress as process 3660
2019-01-14T11:02:07.367698Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-01-14T11:02:07.367779Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /var/mysql/data_3306/ is unusable. You can safely remove it.
2019-01-14T11:02:07.367797Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-14T11:02:07.368023Z 0 [System] [MY-010910] [Server] /var/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.13) MySQL Community Server - GPL.
2019-01-14T11:02:25.091876Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
2019-01-14T11:02:25.091947Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
2019-01-14T11:02:25.092216Z 0 [System] [MY-013169] [Server] /var/mysql/bin/mysqld (mysqld 8.0.13) initializing of server in progress as process 3661
2019-01-14T11:02:25.093893Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-01-14T11:02:25.093941Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /var/mysql/data_3306/ is unusable. You can safely remove it.
2019-01-14T11:02:25.093951Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-14T11:02:25.094040Z 0 [System] [MY-010910] [Server] /var/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.13) MySQL Community Server - GPL.
2019-01-14T11:03:34.555652Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
2019-01-14T11:03:34.555710Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
2019-01-14T11:03:34.555964Z 0 [System] [MY-013169] [Server] /var/mysql/bin/mysqld (mysqld 8.0.13) initializing of server in progress as process 3676
2019-01-14T11:03:34.557598Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-01-14T11:03:34.557644Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /var/mysql/data_3306/ is unusable. You can safely remove it.
2019-01-14T11:03:34.557654Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-14T11:03:34.557738Z 0 [System] [MY-010910] [Server] /var/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.13) MySQL Community Server - GPL.
发现是因为datadir对应的目录里面有文件的原因造成的,修改一下datadir参数,my.cnf信息如下:
[mysqld]
port=3306
datadir=/var/mysql/data_3306
log_error=/var/mysql/data_3306/error.log
basedir=/var/mysql
发现运行成功(通过echo $?
判断)。
然后启动mysqld服务:
var/mysql/bin/mysqld --defaults-file=/var/mysql/data_3306/my.cnf --user=mysql
执行之后,在目录/var/mysql/data_3306/data/
中生成的目录及文件如下:
zifeiy@zifeiy-S1-Series:/var/mysql/data_3306$ ls -l /var/mysql/data_3306/data/
总用量 155712
-rw-r----- 1 zifeiy zifeiy 56 1月 14 19:06 auto.cnf
-rw------- 1 zifeiy zifeiy 1676 1月 14 19:06 ca-key.pem
-rw-r--r-- 1 zifeiy zifeiy 1112 1月 14 19:06 ca.pem
-rw-r--r-- 1 zifeiy zifeiy 1112 1月 14 19:06 client-cert.pem
-rw------- 1 zifeiy zifeiy 1676 1月 14 19:06 client-key.pem
-rw-r----- 1 zifeiy zifeiy 5785 1月 14 19:06 ib_buffer_pool
-rw-r----- 1 zifeiy zifeiy 12582912 1月 14 19:06 ibdata1
-rw-r----- 1 zifeiy zifeiy 50331648 1月 14 19:06 ib_logfile0
-rw-r----- 1 zifeiy zifeiy 50331648 1月 14 19:06 ib_logfile1
drwxr-x--- 2 zifeiy zifeiy 4096 1月 14 19:06 '#innodb_temp'
drwxr-x--- 2 zifeiy zifeiy 4096 1月 14 19:06 mysql
-rw-r----- 1 zifeiy zifeiy 25165824 1月 14 19:06 mysql.ibd
drwxr-x--- 2 zifeiy zifeiy 4096 1月 14 19:06 performance_schema
-rw------- 1 zifeiy zifeiy 1676 1月 14 19:06 private_key.pem
-rw-r--r-- 1 zifeiy zifeiy 452 1月 14 19:06 public_key.pem
-rw-r--r-- 1 zifeiy zifeiy 1112 1月 14 19:06 server-cert.pem
-rw------- 1 zifeiy zifeiy 1676 1月 14 19:06 server-key.pem
drwxr-x--- 2 zifeiy zifeiy 4096 1月 14 19:06 sys
-rw-r----- 1 zifeiy zifeiy 10485760 1月 14 19:06 undo_001
-rw-r----- 1 zifeiy zifeiy 10485760 1月 14 19:06 undo_002
一开始使用
/var/mysql/bin/mysql -uroot -h127.0.0.1 -P3306
登陆MySQL汇报错:
zifeiy@zifeiy-S1-Series:/var/mysql/data_3306$ /var/mysql/bin/mysql -uroot -h127.0.0.1 -P3306
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
但是我们可以在/var/mysql/data_3306/error.log
中看到MySQL服务器提供给我们的临时登陆密码:
zifeiy@zifeiy-S1-Series:/var/mysql/data_3306$ tail -n 2 /var/mysql/data_3306/error.log
2019-01-14T11:06:47.744852Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: *C4gk*8%3lwf
2019-01-14T11:06:48.411733Z 0 [System] [MY-013170] [Server] /var/mysql/bin/mysqld (mysqld 8.0.13) initializing of server has completed
重新登陆,发现登陆成功:
zifeiy@zifeiy-S1-Series:/var/mysql/bin$ ./mysql -uroot -h127.0.0.1 -P3306 -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.13
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
赶快修改密码(我这里改成password
):
alter user 'root'@'localhost' identified by 'password';
为了方便,可以新建一个脚本文件~/start_mysqld.sh
,如下:
echo "/var/mysql/bin/mysqld --defaults-file=/var/mysql/data_3306/my.cnf --user=mysql" > ~/start_mysqld.sh
chmod a+x ~/start_mysqld.sh
以后就可以通过bash ~/start_mysqld.sh
来运行mysqld服务了。
ubuntu18.04手动安装二进制MySQL8.0的更多相关文章
- 在ubuntu18.04中安装opencv_contrib-3.2.0采坑教程
由于最近要在OpenCV3中使用SIFT和SURF特征提取,而自从OpenCV2升级到OpenCV3版本后,SIFT.SURF等这些算法都被移出opencv默认项目库,而被放到叫opencv_cont ...
- Linux中(Ubuntu18.04.x/CentOS)mysql8.0.x安装/配置/部署/启动
The MySQL Connectors and APIs are the drivers and libraries that you use to connect applications in ...
- Ubuntu18.04下安装配置MongoDB4.0.6
搭建MongoDB环境 安装MongoDB 1.下载安装包 MongoDB 提供了 linux 各发行版本 64 位的安装包,你可以在官网下载安装包. 下载地址:https://www.mongodb ...
- Ubuntu18.04下安装搜狗输入法
Ubuntu18.04下安装搜狗输入法 第一步:安装 fcitx输入框架 sudo apt-get install fcitx 第二步:在官网下载 Linux 版本搜狗输入法 https://piny ...
- Ubuntu18.04下安装Sublime Text3!
这几天安装了Ubuntu18.04,然后在里面安装Sublime Text3,结果各种问题!各种BUG!试了网上各种办法!尼玛!都是坑爹的啊! 最后还是楼主自己解决了…… 废话不多说,直接按顺序执行下 ...
- Ubuntu18.04下安装MySQL
Ubuntu上安装MySQL非常简单只需要几条命令就可以完成. 1. sudo apt-get install mysql-server 2. apt-get isntall mysql-client ...
- ubuntu18.04中安装iNode
title: ubuntu18.04中安装iNode toc: false date: 2018-09-01 17:52:20 categories: methods tags: ubuntu iNo ...
- Ubuntu18.04 Server安装Nginx+Git服务和独立的svn服务
安装Nginx+Git 需要安装的包有 nginx, fcgiwrap, git. 其中git在Ubuntu18.04 Server安装时已经默认安装了. 需要安装的是前两个 而fcgiwrap是在 ...
- 二、Ubuntu14.04下安装Hadoop2.4.0 (伪分布模式)
在Ubuntu14.04下安装Hadoop2.4.0 (单机模式)基础上配置 一.配置core-site.xml /usr/local/hadoop/etc/hadoop/core-site.xml ...
随机推荐
- Stone Game
Description There is a stone game.At the beginning of the game the player picks n piles of stones in ...
- Apache Kylin在4399大数据平台的应用
来自:AI前线(微信号:ai-front),作者:林兴财,编辑:Natalie作者介绍:林兴财,毕业于厦门大学计算机科学与技术专业.有多年的嵌入式开发.系统运维经验,现就职于四三九九网络股份有限公司, ...
- 历史相关API
一.history对象 ①history.back()移动到上一个访问页面,等同于浏览器的后退键. ②history.forward()动到下一个访问页面,等同于浏览器的前进键. ③history.g ...
- Python之☞float浮点数精度问题
Python的浮点数损失精度问题(转) 一个简单的面试题: >>>0.1+0.1+0.1 0.2 >>>0.1+0.1+0.1 0.3000000000000000 ...
- lp3676 小清新数据结构题
传送门 Description 有一棵\(n\)个点的树,每个点有一个点权. 现在有\(q\)次操作,每次操作是修改一个点的点权或指定一个点,询问以这个点为根时每棵子树点权和的平方和. Solutio ...
- 9.本地线程(ThreadLoca)
ThreadLoca 提高一个线程的局部变量,访问某个线程都有自己的局部变量,当使用ThreadLoca为每个使用该变量的线程提供独立的变量副本,所以每一个线程都可以独立的改变自己的副本,二不会影响到 ...
- SQL中查询现有未释放连接
SELECT dbid,count() FROM [Master].[dbo].[SYSPROCESSES] WHERE spid> and status='sleeping' group by ...
- Image.FromFile 之后无法删除这个文件
Image.FromFile 之后无法删除这个文件 pictrue图片是从文件加载的,现在想换张图片,更改之前要删除原有的文件,在删除原有的文件出现了异常 string path = @" ...
- ubuntu之路——day11.4 定位数据不匹配与人工合成数据
1.人工检验train和dev/test之间的区别: 比如:汽车语音识别中的噪音.地名难以识别等等 2.使得你的训练集更靠近(相似于)dev/test,收集更多类似于dev的数据: 比如:dev中存在 ...
- Nginx日志按日切分及清理超期的日志文件
Nginx的日志配置如下: #定义日志打印的格式 log_format main '$remote_addr - $remote_user [$time_local] "$request&q ...