linux环境安装——mysql安装复习
B站地址:https://www.bilibili.com/video/BV1qS4y1h77S/?spm_id_from=333.337.search-card.all.click&vd_source=79bbd5b76bfd74c2ef1501653cee29d6
Welcome to Alibaba Cloud Elastic Compute Service ! [root@linux222 ~]# cd / [root@linux222 /]# mkdir -p /soft/mysql8 [root@linux222 /]# mkdir -p /evir/mysql8 [root@linux222 /]# rpm -e --nodeps mariadb-libs [root@linux222 /]# rpm -qa |grep mariadb [root@linux222 /]# tar -xf /soft/mysql8/mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz -C /evir/mysql8/ [root@linux222 /]# cd /evir/mysql8/ [root@linux222 mysql8]# mv mysql-8.0.30-linux-glibc2.12-x86_64/ mysql8030 [root@linux222 mysql8]# cd mysql8030 [root@linux222 mysql8030]# mkdir data [root@linux222 mysql8030]# chmod -R 777 data [root@linux222 mysql8030]# ll total 320 drwxr-xr-x 2 7161 31415 4096 Jul 7 2022 bin drwxrwxrwx 2 root root 4096 Apr 12 15:14 data 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 6 7161 31415 4096 Jul 7 2022 lib -rw-r--r-- 1 7161 31415 287624 Jul 7 2022 LICENSE drwxr-xr-x 4 7161 31415 4096 Jul 7 2022 man -rw-r--r-- 1 7161 31415 666 Jul 7 2022 README drwxr-xr-x 28 7161 31415 4096 Jul 7 2022 share drwxr-xr-x 2 7161 31415 4096 Jul 7 2022 support-files [root@linux222 mysql8030]# groupadd mysql [root@linux222 mysql8030]# useradd -g mysql mysql [root@linux222 mysql8030]# yum install libaio-devel.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): base/7/x86_64/primary_db | 6.1 MB 00:00:00 (2/7): base/7/x86_64/group_gz | 153 kB 00:00:00 (3/7): epel/x86_64/updateinfo | 1.0 MB 00:00:00 (4/7): epel/x86_64/group_gz | 100 kB 00:00:00 (5/7): extras/7/x86_64/primary_db | 253 kB 00:00:00 (6/7): epel/x86_64/primary_db | 7.0 MB 00:00:00 (7/7): updates/7/x86_64/primary_db | 26 MB 00:00:00 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 454 kB/s | 37 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 : 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@linux222 mysql8030]# yum -y install numactl.x86_64 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile 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 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@linux222 mysql8030]# chmod -R 777 /evir/mysql8/mysql8030/data/ [root@linux222 mysql8030]# vim /etc/my.cnf [root@linux222 mysql8030]# cp -a ./support-files/mysql.server /etc/init.d/mysql [root@linux222 mysql8030]# chmod +x /etc/init.d/mysql [root@linux222 mysql8030]# chkconfig --add mysql [root@linux222 mysql8030]# cd bin [root@linux222 bin]# ./mysqld --user=mysql --basedir=/evir/mysql8/mysql8030/ --datadir=/evir/mysql8/mysql8030/data/ --lower-case -table-names=1 --initialize 2024-04-12T07:18:56.775776Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release. 2024-04-12T07:18:56.775878Z 0 [System] [MY-013169] [Server] /evir/mysql8/mysql8030/bin/mysqld (mysqld 8.0.30) initializing of server i n progress as process 5522 2024-04-12T07:18:56.964109Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-04-12T07:18:58.443563Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-04-12T07:18:59.802079Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: V)kR&i*SK3iy [root@linux222 bin]# ^C [root@linux222 bin]# service mysql start Starting MySQL.Logging to '/evir/mysql8/mysql8030/data/linux222.err'. . [ OK ] [root@linux222 bin]# [root@linux222 mysql8030]# service mysql status -bash: [root@linux222: command not found [root@linux222 bin]# service mysql status MySQL running (5911) [ OK ] [root@linux222 bin]# ^C [root@linux222 bin]# cd .. [root@linux222 mysql8030]# ln -s /evir/mysql8/mysql8030/bin/mysql /usr/bin [root@linux222 mysql8030]# 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> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> SHOW DATABASES; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456sww#'; Query OK, 0 rows affected (0.01 sec) mysql> ^C mysql> ^C mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> ^C mysql> user mysql -> ; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user mysql' at line 1 mysql> use mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select * from usr; ERROR 1146 (42S02): Table 'mysql.usr' doesn't exist mysql> show tables; +------------------------------------------------------+ | Tables_in_mysql | +------------------------------------------------------+ | columns_priv | | component | | db | | default_roles | | engine_cost | | func | | general_log | | global_grants | | gtid_executed | | help_category | | help_keyword | | help_relation | | help_topic | | innodb_index_stats | | innodb_table_stats | | password_history | | plugin | | procs_priv | | proxies_priv | | replication_asynchronous_connection_failover | | replication_asynchronous_connection_failover_managed | | replication_group_configuration_version | | replication_group_member_actions | | role_edges | | server_cost | | servers | | slave_master_info | | slave_relay_log_info | | slave_worker_info | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +------------------------------------------------------+ 37 rows in set (0.00 sec) mysql> select * from user; +-----------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+------ ---------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+------------ -----------+------------------+--------------+-----------------+------------------+------------------+----------------+--------------- ------+--------------------+------------------+------------+--------------+------------------------+----------+----------------------- -+--------------------------+----------------------------+---------------+-------------+-----------------+----------------------+----- ------------------+------------------------------------------------------------------------+------------------+----------------------- +-------------------+----------------+------------------+----------------+------------------------+---------------------+------------- -------------+-----------------+ | Host | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutd own_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_ table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine _priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plug in | authentication_string | password_expired | password_last_changed | password_lifetime | account_locked | Create_role_priv | Drop_role_priv | Password_reuse_history | Password_reuse_time | Password_req uire_current | User_attributes | +-----------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+------ ---------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+------------ -----------+------------------+--------------+-----------------+------------------+------------------+----------------+--------------- ------+--------------------+------------------+------------+--------------+------------------------+----------+----------------------- -+--------------------------+----------------------------+---------------+-------------+-----------------+----------------------+----- ------------------+------------------------------------------------------------------------+------------------+----------------------- +-------------------+----------------+------------------+----------------+------------------------+---------------------+------------- -------------+-----------------+ | localhost | mysql.infoschema | Y | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | 0x | 0x | 0x | 0 | 0 | 0 | 0 | cach ing_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | N | 2024-04-12 15:19:00 | NULL | Y | N | N | NULL | NULL | NULL | NULL | | localhost | mysql.session | N | N | N | N | N | N | N | Y | N | N | N | N | N | N | N | Y | N | N | N | N | N | N | N | N | N | N | N | N | N | | 0x | 0x | 0x | 0 | 0 | 0 | 0 | cach ing_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | N | 2024-04-12 15:19:00 | NULL | Y | N | N | NULL | NULL | NULL | NULL | | localhost | mysql.sys | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | 0x | 0x | 0x | 0 | 0 | 0 | 0 | cach ing_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | N | 2024-04-12 15:19:00 | NULL | Y | N | N | NULL | NULL | NULL | NULL | | localhost | root | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | 0x | 0x | 0x | 0 | 0 | 0 | 0 | mysq l_native_password | *7EE84A0E9FB81F4658DAECBD6C9539B30663E803 | N | 2024-04-12 15:23:43 | NULL | N | Y | Y | NULL | NULL | NULL | NULL | +-----------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+------ ---------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+------------ -----------+------------------+--------------+-----------------+------------------+------------------+----------------+--------------- ------+--------------------+------------------+------------+--------------+------------------------+----------+----------------------- -+--------------------------+----------------------------+---------------+-------------+-----------------+----------------------+----- ------------------+------------------------------------------------------------------------+------------------+----------------------- +-------------------+----------------+------------------+----------------+------------------------+---------------------+------------- -------------+-----------------+ 4 rows in set (0.00 sec) mysql> select * from user \desg; -> ; -> ^C mysql> mysql> mysql> show databases; -> +--------------------+ -> | Database | -> +--------------------+ -> | information_schema | -> | mysql | -> | performance_schema | -> | sys | -> +--------------------+ -> 4 rows in set (0.00 sec) -> ; -> ^C mysql> SELECT user, host FROM mysql.user; -> ; -> ^C mysql> SELECT User, Host FROM mysql.user; -> -> ; -> ^C mysql> show tables; -> ^C mysql> quit; -> ^C mysql> exit Bye [root@linux222 mysql8030]#
ali云需要开放安全组,设置开发3306端口。
python需要安装pymysql库和下面这个库:
pip install cryptography
import pymysql # 连接 MySQL 数据库 conn = pymysql.connect( host='159.xxx.xxx.216', # 主机名 port=3306, # 端口号,MySQL默认为3306 user='xxxx', # 用户名 password='xxxx', # 密码 database='xx', # 数据库名称 ) # 创建游标对象 cursor = conn.cursor() # 执行 SQL 查询语句 cursor.execute("SELECT * FROM users WHERE gender='female'") # 获取查询结果 result = cursor.fetchall()
下面这个文件和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 root@47.120.61.196 │ │ • 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>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」
2021-04-08 自动化——测试开发进阶——flask——flask环境准备和示例
2020-04-08 python+requests+new——get请求各种情况