安装MySQL数据库-具体操作指令

以下是我安装数据库时的具体指令,希望对大家有所帮助

[root@localhost ~]# rm -fr /stage/
[root@localhost ~]# rm -fr /labs/
[root@localhost ~]# ./setup.sh
bash: ./setup.sh: No such file or directory
[root@localhost ~]# cd Desktop/
[root@localhost Desktop]# ./setup.sh
Archive:  /modules/p30416104_570_Linux-x86-64.zip
 extracting: /stage/MySQL-Server/mysql-advanced-5.7.28-el7-x86_64.tar.gz  
Archive:  /modules/p30416974_580_Linux-x86-64.zip
 extracting: /stage/MySQL-Server/mysql-commercial-8.0.18-el7-x86_64.tar.gz  
Archive:  /modules/p30417240_580_Linux-x86-64.zip
  inflating: /stage/MySQL-Server/mysql-enterprise-server-8.0.18.tar  
Archive:  /modules/p30416047_800_Linux-x86-64.zip
 extracting: /stage/MySQL-Shell/mysql-shell-commercial-8.0.18-1.1.el7.x86_64.rpm  
 extracting: /stage/MySQL-Shell/mysql-shell-commercial-debuginfo-8.0.18-1.1.el7.x86_64.rpm  
 extracting: /stage/MySQL-Shell/README.txt  
Archive:  /modules/p30485437_800_Linux-x86-64.zip
  inflating: /stage/MySQL-EM/mysqlmonitor-8.0.18.1217-linux-x86_64-update-installer.bin  
  inflating: /stage/MySQL-EM/mysqlmonitor-8.0.18.1217-linux-x86_64-installer.bin  
  inflating: /stage/MySQL-EM/README_en.txt  
  inflating: /stage/MySQL-EM/monitor.a4.pdf  
  inflating: /stage/MySQL-EM/monitor.pdf  
 extracting: /stage/MySQL-EM/mysql-monitor-html.zip  
  inflating: /stage/MySQL-EM/mysql-monitor-html.tar.gz  
  inflating: /stage/MySQL-EM/READ_ME_ja.txt  
Archive:  /modules/p30417246_800_Linux-x86-64.zip
 extracting: /stage/MySQL-WB/mysql-workbench-commercial-8.0.18-1.1.el7.x86_64.rpm  
 extracting: /stage/MySQL-WB/mysql-workbench-commercial-debuginfo-8.0.18-1.1.el7.x86_64.rpm  
 extracting: /stage/MySQL-WB/README.txt  
Archive:  /modules/dependencies.zip
  inflating: /stage/MySQL-WB/dependencies/proj-4.8.0-4.el7.x86_64.rpm  
  inflating: /stage/MySQL-WB/dependencies/libzip-0.10.1-8.el7.x86_64.rpm  
Archive:  /modules/databases.zip
   creating: /stage/databases/employees_db/
  inflating: /stage/databases/employees_db/Changelog  
  inflating: /stage/databases/employees_db/employees.sql  
  inflating: /stage/databases/employees_db/employees_partitioned.sql  
  inflating: /stage/databases/employees_db/employees_partitioned2.sql  
  inflating: /stage/databases/employees_db/employees_partitioned3.sql  
  inflating: /stage/databases/employees_db/load_departments.dump  
  inflating: /stage/databases/employees_db/load_dept_emp.dump  
  inflating: /stage/databases/employees_db/load_dept_manager.dump  
  inflating: /stage/databases/employees_db/load_employees.dump  
  inflating: /stage/databases/employees_db/load_salaries.dump  
  inflating: /stage/databases/employees_db/load_titles.dump  
  inflating: /stage/databases/employees_db/objects.sql  
  inflating: /stage/databases/employees_db/README  
  inflating: /stage/databases/employees_db/test_employees_md5.sql  
  inflating: /stage/databases/employees_db/test_employees_sha.sql  
   creating: /stage/databases/sakila-db/
  inflating: /stage/databases/sakila-db/sakila-data.sql  
  inflating: /stage/databases/sakila-db/sakila-schema.sql  
  inflating: /stage/databases/sakila-db/sakila.mwb  
  inflating: /stage/databases/world.sql  
Archive:  /modules/labs.zip
  inflating: /labs/firewall_training.sql  
  inflating: /labs/multi.cnf         
  inflating: /labs/my.cnf            
   creating: /labs/service-5.7/
  inflating: /labs/service-5.7/mysqld.service  
   creating: /labs/service-8.0/
  inflating: /labs/service-8.0/mysqld.service  
  inflating: /labs/service-8.0/mysqld@.service  
  inflating: /labs/slap-test-updates.sh  
  inflating: /labs/idc-setup.sh      
  inflating: /labs/repl.cnf          
  inflating: /labs/replerror.sh      
  inflating: /labs/replfailover.sh   
[root@localhost Desktop]# cd
[root@localhost ~]# cd /opt
[root@localhost opt]# pwd
/opt
[root@localhost opt]# tar xf /stage/MySQL-server/mysql-advanced-5.7*.tar.gz
tar: /stage/MySQL-server/mysql-advanced-5.7*.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
[root@localhost opt]# cd /stage/
[root@localhost stage]# ls
databases  MySQL-EM  MySQL-Server  MySQL-Shell  MySQL-WB
[root@localhost stage]# cd
[root@localhost ~]# cd /opt
[root@localhost opt]# pwd
/opt
[root@localhost opt]# tar xf /stage/MySQL-Server/mysql-advanced-5.7*.tar.gz
[root@localhost opt]# ln -s /opt/mysql* /usr/local/mysql
[root@localhost opt]# ls /usr/local/mysql/bin
innochecksum                mysql_config_editor        mysqlshow
lz4_decompress              mysqld                     mysqlslap
myisamchk                   mysqld-debug               mysql_ssl_rsa_setup
myisam_ftdump               mysqld_multi               mysqltest_embedded
myisamlog                   mysqld_safe                mysql_tzinfo_to_sql
myisampack                  mysqldump                  mysql_upgrade
my_print_defaults           mysqldumpslow              mysqlxtest
mysql                       mysql_embedded             perror
mysqladmin                  mysqlimport                replace
mysqlbinlog                 mysql_install_db           resolveip
mysqlcheck                  mysql_plugin               resolve_stack_dump
mysql_client_test_embedded  mysqlpump                  zlib_decompress
mysql_config                mysql_secure_installation
[root@localhost opt]# cd ~
[root@localhost ~]# pwd
/root
[root@localhost ~]# ls -a
-                .bash_profile  Desktop        initial-setup-ks.cfg  Public
.                .bashrc        dirtest        .local                .tcshrc
..               .cache         Documents      Music                 Templates
anaconda-ks.cfg  .config        Downloads      mytest                testmod
.bash_history    .cshrc         .esd_auth      p                     Videos
.bash_logout     .dbus          .ICEauthority  Pictures
[root@localhost ~]# vi .bashrc
[root@localhost ~]# cp /labs/my.cnf
cp: missing destination file operand after ‘/labs/my.cnf’
Try 'cp --help' for more information.
[root@localhost ~]# cp /labs/my.cnf /etc/my.cnf
cp: overwrite ‘/etc/my.cnf’? y
[root@localhost ~]# adduser -r mysql
[root@localhost ~]# source .bashrc
[root@localhost ~]# mysqld --initialize
2022-07-19T07:56:46.827919Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-19T07:56:47.013934Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-07-19T07:56:47.040055Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-07-19T07:56:47.096160Z 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: 569bb55b-0738-11ed-8be8-c43ee7ce5230.
2022-07-19T07:56:47.096778Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-07-19T07:56:47.648897Z 0 [Warning] CA certificate ca.pem is self signed.
2022-07-19T07:56:47.936558Z 1 [Note] A temporary password is generated for root@localhost: oNx%FSYPy1wJ
[root@localhost ~]#

新建一个show:

[root@localhost ~]# pgrep -lf mysqld
6959 mysqld_safe
7103 mysqld
[root@localhost ~]# vi /etc/my.cnf
[root@localhost ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.28-enterprise-commercial-advanced

Copyright (c) 2000, 2019, 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> use mysql
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER USER() IDENTIFIED BY 'oracle';
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

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> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| engine_cost               |
| event                     |
| func                      |
| general_log               |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| 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                      |
+---------------------------+
31 rows in set (0.00 sec)

mysql> exit
Bye
[root@localhost ~]#

谢谢您的点赞和支持

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值