B站地址:https://www.bilibili.com/video/BV1qS4y1h77S/?spm_id_from=333.337.search-card.all.click&vd_source=79bbd5b76bfd74c2ef1501653cee29d6
下面这个文件和mysql有冲突,需要优先查找并删除:
阿里云系统:cenos 7 64位数;
安装包:mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz
安装过程:
Session stopped - Press <Return> to exit tab - Press R to restart session - Press S to save terminal output to file ┌──────────────────────────────────────────────────────────────────────┐ │ • MobaXterm Personal Edition v23.4 • │ │ (SSH client, X server and network tools) │ │ │ │ ⮞ SSH session to [email protected] │ │ • Direct SSH : ✓ │ │ • SSH compression : ✓ │ │ • SSH-browser : ✓ │ │ • X11-forwarding : ✗ (disabled or not supported by server) │ │ │ │ ⮞ For more info, ctrl+click on help or visit our website. │ └──────────────────────────────────────────────────────────────────────┘ Welcome to Alibaba Cloud Elastic Compute Service ! [root@iZf8zi6zcbssmm6c2nrhapZ ~]# cd / [root@iZf8zi6zcbssmm6c2nrhapZ /]# rpm -qa|grep mariadb mariadb-libs-5.5.68-1.el7.x86_64 [root@iZf8zi6zcbssmm6c2nrhapZ /]# rpm -e --nodeps mariadb-libs [root@iZf8zi6zcbssmm6c2nrhapZ /]# rpm -qa|grep mariadb [root@iZf8zi6zcbssmm6c2nrhapZ /]# mkdir -p /soft/mysql8 [root@iZf8zi6zcbssmm6c2nrhapZ /]# mkdir -p /evir/mysql8 [root@iZf8zi6zcbssmm6c2nrhapZ /]# tar -xf /soft/mysql8/mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz -C /evir/mysql8/ [root@iZf8zi6zcbssmm6c2nrhapZ /]# cd /evir/mysql8/ [root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# ls -alt total 12 drwxr-xr-x 9 root root 4096 Apr 8 19:23 mysql-8.0.30-linux-glibc2.12-x86_64 drwxr-xr-x 3 root root 4096 Apr 8 19:22 . drwxr-xr-x 3 root root 4096 Apr 8 19:20 .. [root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# mv mysql-8.0.30-linux-glibc2.12-x86_64 msql8030 [root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# ls -alt total 12 drwxr-xr-x 3 root root 4096 Apr 8 19:23 . drwxr-xr-x 9 root root 4096 Apr 8 19:23 msql8030 drwxr-xr-x 3 root root 4096 Apr 8 19:20 .. [root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# mv msql8030 mysql8030 [root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# ls -alt total 12 drwxr-xr-x 3 root root 4096 Apr 8 19:24 . drwxr-xr-x 9 root root 4096 Apr 8 19:23 mysql8030 drwxr-xr-x 3 root root 4096 Apr 8 19:20 .. [root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# cd mysql8030/ [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# ls -alt total 324 drwxr-xr-x 3 root root 4096 Apr 8 19:24 .. drwxr-xr-x 9 root root 4096 Apr 8 19:23 . drwxr-xr-x 2 7161 31415 4096 Jul 7 2022 bin drwxr-xr-x 6 7161 31415 4096 Jul 7 2022 lib drwxr-xr-x 28 7161 31415 4096 Jul 7 2022 share drwxr-xr-x 2 7161 31415 4096 Jul 7 2022 support-files drwxr-xr-x 2 7161 31415 4096 Jul 7 2022 docs drwxr-xr-x 3 7161 31415 4096 Jul 7 2022 include drwxr-xr-x 4 7161 31415 4096 Jul 7 2022 man -rw-r--r-- 1 7161 31415 287624 Jul 7 2022 LICENSE -rw-r--r-- 1 7161 31415 666 Jul 7 2022 README [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# mkdir data [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# ls -alt total 328 drwxr-xr-x 10 root root 4096 Apr 8 19:24 . drwxr-xr-x 2 root root 4096 Apr 8 19:24 data drwxr-xr-x 3 root root 4096 Apr 8 19:24 .. drwxr-xr-x 2 7161 31415 4096 Jul 7 2022 bin drwxr-xr-x 6 7161 31415 4096 Jul 7 2022 lib drwxr-xr-x 28 7161 31415 4096 Jul 7 2022 share drwxr-xr-x 2 7161 31415 4096 Jul 7 2022 support-files drwxr-xr-x 2 7161 31415 4096 Jul 7 2022 docs drwxr-xr-x 3 7161 31415 4096 Jul 7 2022 include drwxr-xr-x 4 7161 31415 4096 Jul 7 2022 man -rw-r--r-- 1 7161 31415 287624 Jul 7 2022 LICENSE -rw-r--r-- 1 7161 31415 666 Jul 7 2022 README [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# chmod -R 777 /evir/mysql8/mysql8030/data/ [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# groupadd mysql [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# useradd -g mysql mysql [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# chown -R mysql.mysql /evir/mysql8/mysql8030 [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# cd bin [root@iZf8zi6zcbssmm6c2nrhapZ bin]# ls -a;l;t . myisamchk mysql mysql_config_editor mysqldump mysql_secure_installation mysql_upgrade .. myisam_ftdump mysqladmin mysqld mysqldumpslow mysqlshow perror ibd2sdi myisamlog mysqlbinlog mysqld-debug mysqlimport mysqlslap zlib_decompress innochecksum myisampack mysqlcheck mysqld_multi mysql_migrate_keyring mysql_ssl_rsa_setup lz4_decompress my_print_defaults mysql_config mysqld_safe mysqlpump mysql_tzinfo_to_sql -bash: l: command not found -bash: t: command not found [root@iZf8zi6zcbssmm6c2nrhapZ bin]# ls -alt total 799844 drwxr-xr-x 10 mysql mysql 4096 Apr 8 19:24 .. drwxr-xr-x 2 mysql mysql 4096 Jul 7 2022 . -rwxr-xr-x 1 mysql mysql 120809811 Jul 7 2022 mysqld -rwxr-xr-x 1 mysql mysql 9545230 Jul 7 2022 mysqlpump -rwxr-xr-x 1 mysql mysql 9061267 Jul 7 2022 mysqlbinlog -rwxr-xr-x 1 mysql mysql 8484338 Jul 7 2022 mysql_migrate_keyring -rwxr-xr-x 1 mysql mysql 8651431 Jul 7 2022 mysql -rwxr-xr-x 1 mysql mysql 8501953 Jul 7 2022 mysql_upgrade -rwxr-xr-x 1 mysql mysql 8345092 Jul 7 2022 mysqldump -rwxr-xr-x 1 mysql mysql 8252148 Jul 7 2022 mysqlcheck -rwxr-xr-x 1 mysql mysql 475435 Jul 7 2022 mysql_config_editor -rwxr-xr-x 1 mysql mysql 8221011 Jul 7 2022 mysqlshow -rwxr-xr-x 1 mysql mysql 8246840 Jul 7 2022 mysqlslap -rwxr-xr-x 1 mysql mysql 8231447 Jul 7 2022 mysqladmin -rwxr-xr-x 1 mysql mysql 8220044 Jul 7 2022 mysqlimport -rwxr-xr-x 1 mysql mysql 8204842 Jul 7 2022 mysql_secure_installation -rwxr-xr-x 1 mysql mysql 752994 Jul 7 2022 ibd2sdi -rwxr-xr-x 1 mysql mysql 335783 Jul 7 2022 mysql_tzinfo_to_sql -rwxr-xr-x 1 mysql mysql 591949 Jul 7 2022 innochecksum -rwxr-xr-x 1 mysql mysql 1231617 Jul 7 2022 perror -rwxr-xr-x 1 mysql mysql 7216223 Jul 7 2022 myisampack -rwxr-xr-x 1 mysql mysql 7393374 Jul 7 2022 myisamchk -rwxr-xr-x 1 mysql mysql 7130273 Jul 7 2022 myisam_ftdump -rwxr-xr-x 1 mysql mysql 7097799 Jul 7 2022 myisamlog -rwxr-xr-x 1 mysql mysql 388414 Jul 7 2022 lz4_decompress -rwxr-xr-x 1 mysql mysql 485400 Jul 7 2022 my_print_defaults -rwxr-xr-x 1 mysql mysql 352135 Jul 7 2022 zlib_decompress -rwxr-xr-x 1 mysql mysql 575427 Jul 7 2022 mysql_ssl_rsa_setup -rwxr-xr-x 1 mysql mysql 5084 Jul 7 2022 mysql_config -rwxr-xr-x 1 mysql mysql 27492 Jul 7 2022 mysqld_multi -rwxr-xr-x 1 mysql mysql 29183 Jul 7 2022 mysqld_safe -rwxr-xr-x 1 mysql mysql 7669 Jul 7 2022 mysqldumpslow -rwxr-xr-x 1 mysql mysql 562094871 Jul 7 2022 mysqld-debug [root@iZf8zi6zcbssmm6c2nrhapZ bin]# ./mysqld --user=mysql --basedir=/evir/mysql8/mysql8030/ --datadir=/evir/mysql8/mysql8030/data/ --lower-case -table-names=1 --initialize ./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory [root@iZf8zi6zcbssmm6c2nrhapZ bin]# yum -y install numactl.x86_64 Loaded plugins: fastestmirror Determining fastest mirrors base | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/7): epel/x86_64/group_gz | 100 kB 00:00:00 (2/7): epel/x86_64/updateinfo | 1.0 MB 00:00:00 (3/7): base/7/x86_64/group_gz | 153 kB 00:00:00 (4/7): epel/x86_64/primary_db | 7.0 MB 00:00:00 (5/7): extras/7/x86_64/primary_db | 253 kB 00:00:00 (6/7): updates/7/x86_64/primary_db | 26 MB 00:00:00 (7/7): base/7/x86_64/primary_db | 6.1 MB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package numactl.x86_64 0:2.0.12-5.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================== Installing: numactl x86_64 2.0.12-5.el7 base 66 k Transaction Summary ===================================================================================================================================================== Install 1 Package Total download size: 66 k Installed size: 141 k Downloading packages: numactl-2.0.12-5.el7.x86_64.rpm | 66 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction ** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows: 2:postfix-2.10.1-9.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit) 2:postfix-2.10.1-9.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit) Installing : numactl-2.0.12-5.el7.x86_64 1/1 Verifying : numactl-2.0.12-5.el7.x86_64 1/1 Installed: numactl.x86_64 0:2.0.12-5.el7 Complete! [root@iZf8zi6zcbssmm6c2nrhapZ bin]# yum install libaio-devel.x86_64 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed --> Processing Dependency: libaio(x86-64) = 0.3.109-13.el7 for package: libaio-devel-0.3.109-13.el7.x86_64 --> Running transaction check ---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================== Installing: libaio-devel x86_64 0.3.109-13.el7 base 13 k Installing for dependencies: libaio x86_64 0.3.109-13.el7 base 24 k Transaction Summary ===================================================================================================================================================== Install 1 Package (+1 Dependent package) Total download size: 37 k Installed size: 46 k Is this ok [y/d/N]: y Downloading packages: (1/2): libaio-0.3.109-13.el7.x86_64.rpm | 24 kB 00:00:00 (2/2): libaio-devel-0.3.109-13.el7.x86_64.rpm | 13 kB 00:00:00 ----------------------------------------------------------------------------------------------------------------------------------------------------- Total 290 kB/s | 37 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : libaio-0.3.109-13.el7.x86_64 1/2 Installing : libaio-devel-0.3.109-13.el7.x86_64 2/2 Verifying : libaio-0.3.109-13.el7.x86_64 1/2 Verifying : libaio-devel-0.3.109-13.el7.x86_64 2/2 Installed: libaio-devel.x86_64 0:0.3.109-13.el7 Dependency Installed: libaio.x86_64 0:0.3.109-13.el7 Complete! [root@iZf8zi6zcbssmm6c2nrhapZ bin]# rpm -qa|grep libaio libaio-0.3.109-13.el7.x86_64 libaio-devel-0.3.109-13.el7.x86_64 [root@iZf8zi6zcbssmm6c2nrhapZ bin]# ./mysqld --user=mysql --basedir=/evir/mysql8/mysql8030/ --datadir=/evir/mysql8/mysql8030/data/ --lower-case -table-names=1 --initialize 2024-04-08T11:28:31.062502Z 0 [System] [MY-013169] [Server] /evir/mysql8/mysql8030/bin/mysqld (mysqld 8.0.30) initializing of server in progress as p rocess 5464 2024-04-08T11:28:31.250296Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-04-08T11:28:32.800425Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-04-08T11:28:34.668583Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 0xw*/-k:EcjZ [root@iZf8zi6zcbssmm6c2nrhapZ bin]# ^C [root@iZf8zi6zcbssmm6c2nrhapZ bin]# vim /etc/my.cnf [root@iZf8zi6zcbssmm6c2nrhapZ bin]# cd .. [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# cp -a ./support-files/mysql.server /etc/init.d/mysql [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# chmod +x /etc/init.d/mysql [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# service mysql start Starting MySQL.Logging to '/evir/mysql8/mysql8030/data/iZf8zi6zcbssmm6c2nrhapZ.err'. .The server quit without updating PID file (/evir/mysql8/my[FAILED]data//iZf8zi6zcbssmm6c2nrhapZ.pid). [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# chmod -R 777 /evir/mysql8/mysql8030/data [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# service mysql start Starting MySQL..The server quit without updating PID file ([FAILED]sql8/mysql8030/data//iZf8zi6zcbssmm6c2nrhapZ.pid). [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# vim /etc/my.cnf [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# service mysql start Starting MySQL.. [ OK ] [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# service mysql status MySQL running (8173) [ OK ] [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# ^C [root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]#
参照文档:https://blog.csdn.net/studio_1/article/details/128345934
[root@iZf8zi6zcbssmm6c2nrhapZ bin]# ln -s /evir/mysql8/mysql8030/bin/mysql /usr/bin [root@iZf8zi6zcbssmm6c2nrhapZ bin]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.30 Copyright (c) 2000, 2022, Oracle and/or its affiliates. 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> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456sww#'; Query OK, 0 rows affected (0.01 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec) mysql>
标签:安装,mysql,Jul,iZf8zi6zcbssmm6c2nrhapZ,2022,linux,xr,root From: https://www.cnblogs.com/xiaobaibailongma/p/18122401