码迷,mamicode.com
首页 > 数据库 > 详细

linux安装mysql 的坑

时间:2020-06-18 21:27:07      阅读:89      评论:0      收藏:0      [点我收藏+]

标签:iba   oca   nat   director   crypto   nod   chm   alt   dso   

Xshell 6 (Build 0189)
Copyright (c) 2002 NetSarang Computer, Inc. All rights reserved.

Type `help‘ to learn how to use Xshell prompt.
[C:\~]$

Connecting to 192.168.1.10:22...
Connection established.
To escape to local shell, press ‘Ctrl+Alt+]‘.

Activate the web console with: systemctl enable --now cockpit.socket

Last login: Wed Jun 17 13:32:17 2020 from 192.168.1.6
[root@localhost ~]# cd /
[root@localhost /]# pwd
/
[root@localhost /]# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
[root@localhost /]# cd /usr
[root@localhost usr]# cd ./local/env/mysql
[root@localhost mysql]# ls
mysql mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz
[root@localhost mysql]# groupadd mysql
[root@localhost mysql]# useradd -r -g mysql mysql
[root@localhost mysql]# rpm -qa|grep libaio
libaio-0.3.112-1.el8.x86_64
[root@localhost mysql]# yum search libaio
上次元数据过期检查:22:13:47 前,执行于 2020年06月17日 星期三 13时06分53秒。
================================================================= 名称 精准匹配:libaio =================================================================
libaio.x86_64 : Linux-native asynchronous I/O access library
libaio.i686 : Linux-native asynchronous I/O access library
libaio.x86_64 : Linux-native asynchronous I/O access library
=================================================================== 名称 匹配:libaio ===================================================================
libaio-devel.i686 : Development files for Linux-native asynchronous I/O access
libaio-devel.x86_64 : Development files for Linux-native asynchronous I/O access
[root@localhost mysql]# yum install libaio
上次元数据过期检查:0:00:42 前,执行于 2020年06月18日 星期四 11时23分25秒。
软件包 libaio-0.3.112-1.el8.x86_64 已安装。
依赖关系解决。
无需任何处理。
完毕!
[root@localhost mysql]# ls
mysql mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz
[root@localhost mysql]# touch /etc/my.cnf
[root@localhost mysql]# ls
mysql mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz
[root@localhost mysql]# cd ./mysql
[root@localhost mysql]# ls
bin docs include lib LICENSE man README share support-files
[root@localhost mysql]# touch /etc/my.cnf
[root@localhost mysql]# pwd
/usr/local/env/mysql/mysql
[root@localhost mysql]# sudo find / -name my.cnf
/etc/my.cnf

 

^H^H^H^C
[root@localhost mysql]# sudo mysql --help|grep my.cnf
sudo: mysql:找不到命令
[root@localhost mysql]# pwd
/usr/local/env/mysql/mysql
[root@localhost mysql]# mkdir data
[root@localhost mysql]# ls
bin data docs include lib LICENSE man README share support-files
[root@localhost mysql]# ll
总用量 408
drwxr-xr-x. 2 7161 31415 4096 3月 27 05:53 bin
drwxr-xr-x. 2 root root 6 6月 18 11:45 data
drwxr-xr-x. 2 7161 31415 55 3月 27 05:53 docs
drwxr-xr-x. 3 7161 31415 282 3月 27 05:53 include
drwxr-xr-x. 6 7161 31415 201 3月 27 05:53 lib
-rw-r--r--. 1 7161 31415 404604 3月 26 21:31 LICENSE
drwxr-xr-x. 4 7161 31415 30 3月 27 05:53 man
-rw-r--r--. 1 7161 31415 687 3月 26 21:31 README
drwxr-xr-x. 28 7161 31415 4096 3月 27 05:53 share
drwxr-xr-x. 2 7161 31415 77 3月 27 05:53 support-files
[root@localhost mysql]# chown -R mysql:mysql ./
[root@localhost mysql]# ll
总用量 408
drwxr-xr-x. 2 mysql mysql 4096 3月 27 05:53 bin
drwxr-xr-x. 2 mysql mysql 6 6月 18 11:45 data
drwxr-xr-x. 2 mysql mysql 55 3月 27 05:53 docs
drwxr-xr-x. 3 mysql mysql 282 3月 27 05:53 include
drwxr-xr-x. 6 mysql mysql 201 3月 27 05:53 lib
-rw-r--r--. 1 mysql mysql 404604 3月 26 21:31 LICENSE
drwxr-xr-x. 4 mysql mysql 30 3月 27 05:53 man
-rw-r--r--. 1 mysql mysql 687 3月 26 21:31 README
drwxr-xr-x. 28 mysql mysql 4096 3月 27 05:53 share
drwxr-xr-x. 2 mysql mysql 77 3月 27 05:53 support-files
[root@localhost mysql]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/env/mysql/mysql --datadir=/usr/local/env/mysql/mysql/data
2020-06-18T03:49:10.145026Z 0 [System] [MY-013169] [Server] /usr/local/env/mysql/mysql/bin/mysqld (mysqld 8.0.20) initializing of server in progress as process 2698
2020-06-18T03:49:10.164962Z 0 [Warning] [MY-013242] [Server] --character-set-server: ‘utf8‘ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-06-18T03:49:10.216390Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-06-18T03:49:17.277257Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-06-18T03:49:27.931144Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: %!?94!rKY1?o
[root@localhost mysql]# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@localhost mysql]# chmod +x /etc/rc.d/init.d/mysqld
[root@localhost mysql]# chkconfig --add mysqld
[root@localhost mysql]# chkconfig --list mysqld

注:该输出结果只显示 SysV 服务,并不包含
原生 systemd 服务。SysV 配置数据
可能被原生 systemd 配置覆盖。

要列出 systemd 服务,请执行 ‘systemctl list-unit-files‘。
查看在具体 target 启用的服务请执行
‘systemctl list-dependencies [target]‘。

mysqld 0:关 1:关 2:开 3:开 4:开 5:开 6:关
[root@localhost mysql]# service mysqld start
/etc/init.d/mysqld: line 239: my_print_defaults: command not found
/etc/init.d/mysqld: line 259: cd: /usr/local/mysql: No such file or directory
Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)
[root@localhost mysql]# ^C
[root@localhost mysql]# /etc/rc.d/init.d/mysqld start
/etc/rc.d/init.d/mysqld:行239: my_print_defaults: 未找到命令
/etc/rc.d/init.d/mysqld: 第 259 行:cd: /usr/local/mysql: 没有那个文件或目录
Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)
[root@localhost mysql]# /etc/rc.d/init.d/mysqld start
/etc/rc.d/init.d/mysqld:行239: my_print_defaults: 未找到命令
/etc/rc.d/init.d/mysqld: 第 259 行:cd: /usr/local/mysql: 没有那个文件或目录
Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)
[root@localhost mysql]# /etc/init.d/mysqld start
/etc/init.d/mysqld:行239: my_print_defaults: 未找到命令
/etc/init.d/mysqld: 第 259 行:cd: /usr/local/mysql: 没有那个文件或目录
Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)
[root@localhost mysql]# service mysqld start
/etc/init.d/mysqld: line 239: my_print_defaults: command not found
/etc/init.d/mysqld: line 259: cd: /usr/local/mysql: No such file or directory
Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)
[root@localhost mysql]# sed -i ‘s#/usr/local#/application#g‘ /etc/init.d/mysqld /application/mysql/bin/mysqld_safe
sed:无法读取 /application/mysql/bin/mysqld_safe:没有那个文件或目录
[root@localhost mysql]# pwd
/usr/local/env/mysql/mysql
[root@localhost mysql]# cd bin
[root@localhost bin]# .mysqld_safe --user=mysql& #
[1] 3134
[root@localhost bin]# bash: .mysqld_safe: 未找到命令...
^C
[1]+ 退出 127 .mysqld_safe --user=mysql
[root@localhost bin]# service mysqld status
/etc/init.d/mysqld: line 239: my_print_defaults: command not found
ERROR! MySQL is not running
[root@localhost bin]# service mysqld start
/etc/init.d/mysqld: line 239: my_print_defaults: command not found
/etc/init.d/mysqld: line 259: cd: /application/mysql: No such file or directory
Starting MySQL ERROR! Couldn‘t find MySQL server (/application/mysql/bin/mysqld_safe)
[root@localhost bin]# cp /usr/local/env/mysql/mysql/bin/my_print_defaults /usr/bin
[root@localhost bin]# service mysqld status
ERROR! MySQL is not running
[root@localhost bin]# service mysqld start
Starting MySQL.Logging to ‘/usr/local/env/mysql/mysql/data/localhost.err‘.
... SUCCESS!
[root@localhost bin]# source /etc/profile
[root@localhost bin]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/env/mysql/mysql/bin
[root@localhost bin]# cd ..
[root@localhost mysql]# pwd
/usr/local/env/mysql/mysql
[root@localhost mysql]# mysql -uroot -p
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
[root@localhost mysql]# yum search libtinfo.so.5
未找到匹配项。
[root@localhost mysql]# ls /lib/x86_64-linux-gnu/libtinfo.so.*
ls: 无法访问‘/lib/x86_64-linux-gnu/libtinfo.so.*‘: 没有那个文件或目录
[root@localhost mysql]# cd ./bin
[root@localhost bin]# ldd mysql
linux-vdso.so.1 (0x00007ffe93864000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd50c1cc000)
librt.so.1 => /lib64/librt.so.1 (0x00007fd50bfc3000)
libcrypto.so.1.1 => /usr/local/env/mysql/mysql/bin/./../lib/private/libcrypto.so.1.1 (0x00007fd50bb16000)
libssl.so.1.1 => /usr/local/env/mysql/mysql/bin/./../lib/private/libssl.so.1.1 (0x00007fd50b887000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fd50b683000)
libtinfo.so.5 => not found
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fd50b2ee000)
libm.so.6 => /lib64/libm.so.6 (0x00007fd50af6c000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd50ad54000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd50a991000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd50c3ec000)
[root@localhost bin]# ^C
[root@localhost bin]# ^C
[root@localhost bin]# rpm -qa|grep libtinfo
[root@localhost bin]# rpm -qa|grep libaio
libaio-0.3.112-1.el8.x86_64
[root@localhost bin]# sudo in -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5
sudo: in:找不到命令
[root@localhost bin]# sudo ln -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5
[root@localhost bin]# rpm -qa|grep libtinfo
[root@localhost bin]# pwd
/usr/local/env/mysql/mysql/bin
[root@localhost bin]# cd ..
[root@localhost mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.20 MySQL Community Server - GPL

Copyright (c) 2000, 2020, 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>

linux安装mysql 的坑

标签:iba   oca   nat   director   crypto   nod   chm   alt   dso   

原文地址:https://www.cnblogs.com/huanglong1987/p/13159975.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!