linux 中 安装mysql 5.7 数据库

参考这个 大哥的博客,https://blog.csdn.net/qq_37598011/article/details/93489404

下面是自己按照该博客整理的笔记

3.2 linux 安装mysql 5.7 并配置

 

3.2.1.下载

下载:

https://dev.mysql.com/downloads/mysql/5.7.html#downloads

 

 

 

 

3.2.2.上传到Linux服务器上面

放到 /myapp 目录下面

解压 mysql 5.7

  tar -zxvf mysql-5.7.36-linux-glibc2.12-x86_64.tar.gz 

把解压后的文件移动到 /myapp/software/mysql 目录下面

  mv mysql-5.7.36-linux-glibc2.12-x86_64 /myapp/software/mysql

创建mysql 用户组和 用户 并修改权限

 # 1、创建用户组
 groupadd mysql
 
 # 2、创建用户,把用户放到mysql 组中
 useradd -r -g mysql mysql

创建数据目录并赋予权限

 # 1.创建数据目录
 mkdir -p /data/mysql  
 # 2.赋予权限(赋予mysql用户操作 /data/mysql 目录的权限)
 chown mysql:mysql -R /data/mysql

配置my.cnf

 vim /etc/my.cnf

先输入 i 切换到 可以编辑状态, 保存退出时,先 点击ESC ,然后 输入 :wq保存退出

完整的目录如下:

 [mysqld]
 
 bind-address=0.0.0.0
 port=3306
 user=mysql
 basedir=/myapp/software/mysql
 
 datadir=/data/mysql
 socket=/tmp/mysql.sock
 log-error=/data/mysql/mysql.err
 pid-file=/data/mysql/mysql.pid
 character_set_server=utf8mb4
 
 explicit_defaults_for_timestamp=true
 # Disabling symbolic-links is recommended to prevent assorted security risks
 symbolic-links=0
 # Settings user and group are ignored when systemd is used.
 # If you need to run mysqld under a different user or group,
 # customize your systemd unit file for mariadb according to the
 # instructions in http://fedoraproject.org/wiki/Systemd
 
 #
 # include all files from the config directory
 #
 !includedir /etc/my.cnf.d
 

备注:

basedir=/myapp/software/mysql 是 mysql 解压后的目录

user=mysql是刚才创建的mysql 用户

 

初始化mysql 数据库

 # 1.进入mysql 的bin目录
 cd myapp/software/mysql/bin
 
 # 2.初始化mysql数据库命令
 ./mysqld --defaults-file=/etc/my.cnf --basedir=/myapp/software/mysql/ --datadir=/data/mysql/ --user=mysql --initialize

查看密码

 cat /data/mysql/mysql.err
 [root@192 bin]# cat /data/mysql/mysql.err
 2021-10-29T03:52:36.800587Z 0 [Warning] InnoDB: New log files created, LSN=45790
 2021-10-29T03:52:36.820455Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
 2021-10-29T03:52:36.874433Z 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: a7c106fd-386b-11ec-a788-000c2969c071.
 2021-10-29T03:52:36.875787Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
 2021-10-29T03:52:37.712094Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
 2021-10-29T03:52:37.712103Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
 2021-10-29T03:52:37.712627Z 0 [Warning] CA certificate ca.pem is self signed.
 2021-10-29T03:52:37.914828Z 1 [Note] A temporary password is generated for root@localhost: Blfwsup7hM,t
 

最后的那一行就是密码A temporary password is generated for root@localhost: Blfwsup7hM,t

密码是 Blfwsup7hM,t

 

启动mysql,并更改root密码

 # 先将mysql.server放置到/etc/init.d/mysql中
 cp /myapp/software/mysql/support-files/mysql.server /etc/init.d/mysql

 

启动

 # 启动mysql
 service mysql start
 
 看到 ``Starting MySQL. SUCCESS! `` 就说明启动成功了!
 
 # 验证mysql 是否启动成功
  ps -ef|grep mysql
 root     128836      1  0 20:56 pts/0    00:00:00 /bin/sh /myapp/software/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/mysql.pid
 mysql    129063 128836  1 20:56 pts/0    00:00:00 /myapp/software/mysql/bin/mysqld --basedir=/myapp/software/mysql --datadir=/data/mysql --plugin-dir=/myapp/software/mysql/lib/plugin --user=mysql --log-error=/data/mysql/mysql.err --pid-file=/data/mysql/mysql.pid --socket=/tmp/mysql.sock --port=3306
 root     130061   4616  0 20:56 pts/0    00:00:00 grep --color=auto mysql
 

 

到这里,就已经成功安装并启动了mysql 数据库!

 

修改mysql 的root 密码

前面的密码是随机生成的

 #注意: 还是在 mysql 的bin 目录下面 进行修改:
 ./mysql -u root -p

会看到下面的东西,又重新登录了一遍

 Enter password: 
 Welcome to the MySQL monitor. Commands end with ; or \g.
 Your MySQL connection id is 3
 Server version: 5.7.36
 
 Copyright (c) 2000, 2021, 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>

 

再执行下面的三步操作

 # 1.设置root 用户的密码为:  123456
 SET PASSWORD = PASSWORD('123456');
 # 2.修改用户的密码永不过期
 ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
 # 3.让修改的生效
 FLUSH PRIVILEGES;

 

这个时候如果远程连接,还无法连接,会提示 Host '' is not allowed to connect to this Mysql Server

设置可以远程访问

 # 1、使用mysql 数据库
 use mysql
 # 2. 使root 用户 可以再任何host 访问
 update user set host = '%' where user = 'root';
 # 3. 刷新,让修改生效
 FLUSH PRIVILEGES;

 

注意:

如果我在 navicat 中使用 root 创建了一个用户,例如: mysql02 这个时候,想让mysql02 可以在任何的host 中访问

命令:

  update user set host = '%' where user = 'mysql01';

或者 在 navicat 中创建用户的时候,设置用户的主机是 % 即可

 

如果不希望每次都到bin目录下使用mysql命令则执行以下命令

 # /usr/local/mysql/bin/mysql  是 mysql 的安装目录
 ln -s /usr/local/mysql/bin/mysql   /usr/bin

 

 

 

 

------------------------

linux  中的操作记录如下所示


[root@192 myapp]# tar -zxvf mysql-5.7.36-linux-glibc2.12-x86_64.tar.gz mysql-5.7.36-linux-glibc2.12-x86_64/bin/myisam_ftdump mysql-5.7.36-linux-glibc2.12-x86_64/bin/myisamchk mysql-5.7.36-linux-glibc2.12-x86_64/bin/myisamlog mysql-5.7.36-linux-glibc2.12-x86_64/bin/myisampack mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql_client_test_embedded mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql_config_editor mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql_embedded mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql_install_db mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql_plugin mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql_secure_installation mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql_ssl_rsa_setup mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql_tzinfo_to_sql mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql_upgrade mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqladmin mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqlbinlog mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqlcheck mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqldump mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqlimport mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqlpump mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqlshow mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqlslap mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqltest_embedded mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqlxtest mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqld-debug mysql-5.7.36-linux-glibc2.12-x86_64/lib/libmysqld-debug.a mysql-5.7.36-linux-glibc2.12-x86_64/include/mysqlx_ername.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysqlx_error.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysqlx_version.h mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysql_config mysql-5.7.36-linux-glibc2.12-x86_64/include/big_endian.h mysql-5.7.36-linux-glibc2.12-x86_64/include/binary_log_types.h mysql-5.7.36-linux-glibc2.12-x86_64/include/byte_order_generic.h mysql-5.7.36-linux-glibc2.12-x86_64/include/byte_order_generic_x86.h mysql-5.7.36-linux-glibc2.12-x86_64/include/decimal.h mysql-5.7.36-linux-glibc2.12-x86_64/include/errmsg.h mysql-5.7.36-linux-glibc2.12-x86_64/include/keycache.h mysql-5.7.36-linux-glibc2.12-x86_64/include/little_endian.h mysql-5.7.36-linux-glibc2.12-x86_64/include/m_ctype.h mysql-5.7.36-linux-glibc2.12-x86_64/include/m_string.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_alloc.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_byteorder.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_command.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_compiler.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_config.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_dbug.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_dir.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_getopt.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_global.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_list.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_sys.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_thread.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_thread_local.h mysql-5.7.36-linux-glibc2.12-x86_64/include/my_xml.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/client_authentication.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/client_plugin.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/client_plugin.h.pp mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/com_data.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/get_password.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/group_replication_priv.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/innodb_priv.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/mysql_lex_string.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_audit.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_audit.h.pp mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_auth.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_auth.h.pp mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_auth_common.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_ftparser.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_ftparser.h.pp mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_group_replication.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_keyring.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_keyring.h.pp mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_trace.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/plugin_validate_password.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_file.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_idle.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_mdl.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_memory.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_ps.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_socket.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_sp.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_stage.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_statement.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_table.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_thread.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/mysql_transaction.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/psi.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/psi_base.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/psi/psi_memory.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_command.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_locking.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_my_plugin_log.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_my_snprintf.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_mysql_alloc.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_mysql_keyring.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_mysql_password_policy.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_mysql_string.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_parser.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_rpl_transaction_ctx.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_rpl_transaction_write_set.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_rules_table.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_security_context.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_srv_session.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_srv_session_info.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_ssl_wrapper.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_thd_alloc.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_thd_engine_lock.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_thd_wait.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/service_thread_scheduler.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/services.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/services.h.pp mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/thread_pool_priv.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql/thread_type.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql_com.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql_com_server.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql_embed.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql_time.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysql_version.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysqld_ername.h mysql-5.7.36-linux-glibc2.12-x86_64/include/mysqld_error.h mysql-5.7.36-linux-glibc2.12-x86_64/include/plugin.h mysql-5.7.36-linux-glibc2.12-x86_64/include/plugin_audit.h mysql-5.7.36-linux-glibc2.12-x86_64/include/plugin_ftparser.h mysql-5.7.36-linux-glibc2.12-x86_64/include/plugin_group_replication.h mysql-5.7.36-linux-glibc2.12-x86_64/include/plugin_keyring.h mysql-5.7.36-linux-glibc2.12-x86_64/include/plugin_validate_password.h mysql-5.7.36-linux-glibc2.12-x86_64/include/sql_common.h mysql-5.7.36-linux-glibc2.12-x86_64/include/sql_state.h mysql-5.7.36-linux-glibc2.12-x86_64/include/sslopt-case.h mysql-5.7.36-linux-glibc2.12-x86_64/include/sslopt-longopts.h mysql-5.7.36-linux-glibc2.12-x86_64/include/sslopt-vars.h mysql-5.7.36-linux-glibc2.12-x86_64/include/thr_cond.h mysql-5.7.36-linux-glibc2.12-x86_64/include/thr_mutex.h mysql-5.7.36-linux-glibc2.12-x86_64/include/thr_rwlock.h mysql-5.7.36-linux-glibc2.12-x86_64/include/typelib.h mysql-5.7.36-linux-glibc2.12-x86_64/lib/libmysqlclient.a mysql-5.7.36-linux-glibc2.12-x86_64/lib/libmysqlservices.a mysql-5.7.36-linux-glibc2.12-x86_64/lib/pkgconfig/mysqlclient.pc mysql-5.7.36-linux-glibc2.12-x86_64/share/aclocal/mysql.m4 mysql-5.7.36-linux-glibc2.12-x86_64/docs/ChangeLog mysql-5.7.36-linux-glibc2.12-x86_64/docs/INFO_SRC mysql-5.7.36-linux-glibc2.12-x86_64/lib/libmysqld.a mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/comp_err.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/innochecksum.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/lz4_decompress.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/my_print_defaults.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/myisam_ftdump.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/myisamchk.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/myisamlog.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/myisampack.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysql.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysql.server.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysql_config.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysql_config_editor.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysql_install_db.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysql_plugin.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysql_secure_installation.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysql_ssl_rsa_setup.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysql_tzinfo_to_sql.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysql_upgrade.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqladmin.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqlbinlog.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqlcheck.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqld_multi.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqld_safe.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqldump.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqldumpslow.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqlimport.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqlman.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqlpump.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqlshow.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/mysqlslap.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/perror.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/replace.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/resolve_stack_dump.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/resolveip.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man1/zlib_decompress.1 mysql-5.7.36-linux-glibc2.12-x86_64/man/man8/mysqld.8 mysql-5.7.36-linux-glibc2.12-x86_64/LICENSE mysql-5.7.36-linux-glibc2.12-x86_64/README mysql-5.7.36-linux-glibc2.12-x86_64/bin/innochecksum mysql-5.7.36-linux-glibc2.12-x86_64/bin/lz4_decompress mysql-5.7.36-linux-glibc2.12-x86_64/bin/my_print_defaults mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqld mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqld_multi mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqld_safe mysql-5.7.36-linux-glibc2.12-x86_64/bin/mysqldumpslow mysql-5.7.36-linux-glibc2.12-x86_64/bin/perror mysql-5.7.36-linux-glibc2.12-x86_64/bin/replace mysql-5.7.36-linux-glibc2.12-x86_64/bin/resolve_stack_dump mysql-5.7.36-linux-glibc2.12-x86_64/bin/resolveip mysql-5.7.36-linux-glibc2.12-x86_64/bin/zlib_decompress mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/char.bin mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/dicrc mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/left-id.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/matrix.bin mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/pos-id.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/rewrite.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/right-id.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/sys.dic mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/unk.dic mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/char.bin mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/dicrc mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/left-id.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/matrix.bin mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/pos-id.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/rewrite.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/right-id.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/sys.dic mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/unk.dic mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/char.bin mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/dicrc mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/left-id.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/matrix.bin mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/pos-id.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/rewrite.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/right-id.def mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/sys.dic mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/unk.dic mysql-5.7.36-linux-glibc2.12-x86_64/lib/mecab/etc/mecabrc mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/adt_null.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/auth_socket.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/authentication_ldap_sasl_client.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/connection_control.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/adt_null.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/auth_socket.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/authentication_ldap_sasl_client.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/connection_control.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/group_replication.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/ha_example.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/innodb_engine.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/keyring_file.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/keyring_udf.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libmemcached.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libpluginmecab.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_framework.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_services.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_services_threaded.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_session_detach.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_session_in_thd.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_session_info.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_2_sessions.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_all_col_types.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_cmds_1.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_commit.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_complex.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_errors.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_lock.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_processlist.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_replication.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_shutdown.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_sqlmode.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_stored_procedures_functions.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_views_triggers.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_x_sessions_deinit.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_x_sessions_init.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/locking_service.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/mypluglib.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/mysql_no_login.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/mysqlx.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/rewrite_example.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/rewriter.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/semisync_master.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/semisync_slave.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/test_security_context.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/test_udf_services.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/validate_password.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/debug/version_token.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/group_replication.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/ha_example.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/innodb_engine.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/keyring_file.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/keyring_udf.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libmemcached.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libpluginmecab.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_framework.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_services.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_services_threaded.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_session_detach.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_session_in_thd.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_session_info.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_2_sessions.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_all_col_types.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_cmds_1.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_commit.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_complex.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_errors.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_lock.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_processlist.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_replication.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_shutdown.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_sqlmode.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_stored_procedures_functions.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_views_triggers.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_x_sessions_deinit.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/libtest_x_sessions_init.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/locking_service.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/mypluglib.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/mysql_no_login.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/mysqlx.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/rewrite_example.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/rewriter.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/semisync_master.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/semisync_slave.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/test_security_context.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/test_udf_services.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/validate_password.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/plugin/version_token.so mysql-5.7.36-linux-glibc2.12-x86_64/share/bulgarian/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/Index.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/README mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/armscii8.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/ascii.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/cp1250.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/cp1251.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/cp1256.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/cp1257.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/cp850.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/cp852.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/cp866.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/dec8.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/geostd8.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/greek.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/hebrew.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/hp8.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/keybcs2.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/koi8r.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/koi8u.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/latin1.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/latin2.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/latin5.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/latin7.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/macce.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/macroman.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/charsets/swe7.xml mysql-5.7.36-linux-glibc2.12-x86_64/share/czech/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/danish/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/dictionary.txt mysql-5.7.36-linux-glibc2.12-x86_64/share/dutch/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/english/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/errmsg-utf8.txt mysql-5.7.36-linux-glibc2.12-x86_64/share/estonian/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/fill_help_tables.sql mysql-5.7.36-linux-glibc2.12-x86_64/share/french/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/german/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/greek/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/hungarian/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/innodb_memcached_config.sql mysql-5.7.36-linux-glibc2.12-x86_64/share/italian/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/japanese/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/korean/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/mysql_security_commands.sql mysql-5.7.36-linux-glibc2.12-x86_64/share/mysql_sys_schema.sql mysql-5.7.36-linux-glibc2.12-x86_64/share/mysql_system_tables.sql mysql-5.7.36-linux-glibc2.12-x86_64/share/mysql_system_tables_data.sql mysql-5.7.36-linux-glibc2.12-x86_64/share/mysql_test_data_timezone.sql mysql-5.7.36-linux-glibc2.12-x86_64/share/norwegian-ny/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/norwegian/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/polish/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/portuguese/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/romanian/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/russian/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/serbian/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/slovak/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/spanish/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/swedish/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/share/ukrainian/errmsg.sys mysql-5.7.36-linux-glibc2.12-x86_64/support-files/mysql-log-rotate mysql-5.7.36-linux-glibc2.12-x86_64/support-files/mysqld_multi.server mysql-5.7.36-linux-glibc2.12-x86_64/lib/libmysqlclient.so mysql-5.7.36-linux-glibc2.12-x86_64/lib/libmysqlclient.so.20 mysql-5.7.36-linux-glibc2.12-x86_64/lib/libmysqlclient.so.20.3.23 mysql-5.7.36-linux-glibc2.12-x86_64/share/install_rewriter.sql mysql-5.7.36-linux-glibc2.12-x86_64/share/uninstall_rewriter.sql mysql-5.7.36-linux-glibc2.12-x86_64/support-files/magic mysql-5.7.36-linux-glibc2.12-x86_64/support-files/mysql.server mysql-5.7.36-linux-glibc2.12-x86_64/docs/INFO_BIN mysql-5.7.36-linux-glibc2.12-x86_64/docs/INFO_SRC [root@192 myapp]# ls jdk-8u291-linux-x64.tar.gz mysql-5.7.36-linux-glibc2.12-x86_64 software mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz mysql-5.7.36-linux-glibc2.12-x86_64.tar.gz [root@192 myapp]# ll 总用量 1113344 -rw-rw-r--. 1 wanglichao wanglichao 144935989 10月 27 21:28 jdk-8u291-linux-x64.tar.gz -rw-rw-r--. 1 wanglichao wanglichao 328563044 10月 28 20:14 mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz drwxr-xr-x. 9 root root 129 10月 28 20:28 mysql-5.7.36-linux-glibc2.12-x86_64 -rw-rw-r--. 1 wanglichao wanglichao 666559924 10月 28 20:28 mysql-5.7.36-linux-glibc2.12-x86_64.tar.gz drwxrwxr-x. 4 wanglichao wanglichao 69 10月 28 20:15 software [root@192 myapp]# mv mysql-5.7.36-linux-glibc2.12-x86_64 /myapp/software/mysql [root@192 myapp]# mkdir -p /data/mysql [root@192 myapp]# ll 总用量 1113344 -rw-rw-r--. 1 wanglichao wanglichao 144935989 10月 27 21:28 jdk-8u291-linux-x64.tar.gz -rw-rw-r--. 1 wanglichao wanglichao 328563044 10月 28 20:14 mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz -rw-rw-r--. 1 wanglichao wanglichao 666559924 10月 28 20:28 mysql-5.7.36-linux-glibc2.12-x86_64.tar.gz drwxrwxr-x. 5 wanglichao wanglichao 82 10月 28 20:30 software [root@192 myapp]# cd ../ [root@192 /]# ll 总用量 24 lrwxrwxrwx. 1 root root 7 10月 27 20:52 bin -> usr/bin dr-xr-xr-x. 5 root root 4096 10月 27 20:59 boot drwxr-xr-x. 3 root root 19 10月 28 20:35 data drwxr-xr-x. 20 root root 3320 10月 28 19:53 dev drwxr-xr-x. 144 root root 8192 10月 28 20:16 etc drwxr-xr-x. 3 root root 24 10月 27 20:58 home lrwxrwxrwx. 1 root root 7 10月 27 20:52 lib -> usr/lib lrwxrwxrwx. 1 root root 9 10月 27 20:52 lib64 -> usr/lib64 drwxr-xr-x. 2 root root 6 4月 10 2018 media drwxr-xr-x. 2 root root 6 4月 10 2018 mnt drwxrwxr-x. 3 wanglichao wanglichao 156 10月 28 20:30 myapp drwxrw----. 3 wanglichao wanglichao 16 10月 27 20:55 opt dr-xr-xr-x. 239 root root 0 10月 28 19:53 proc dr-xr-x---. 4 root root 203 10月 28 18:24 root drwxr-xr-x. 43 root root 1260 10月 28 19:56 run lrwxrwxrwx. 1 root root 8 10月 27 20:52 sbin -> usr/sbin drwxr-xr-x. 2 root root 6 4月 10 2018 srv dr-xr-xr-x. 13 root root 0 10月 28 19:53 sys drwxrwxrwt. 25 root root 4096 10月 28 20:30 tmp drwxr-xr-x. 14 root root 167 10月 27 21:12 usr drwxr-xr-x. 21 root root 4096 10月 27 20:59 var [root@192 /]# cd data [root@192 data]# ls mysql [root@192 data]# cd ../ [root@192 /]# ll 总用量 24 lrwxrwxrwx. 1 root root 7 10月 27 20:52 bin -> usr/bin dr-xr-xr-x. 5 root root 4096 10月 27 20:59 boot drwxr-xr-x. 3 root root 19 10月 28 20:35 data drwxr-xr-x. 20 root root 3320 10月 28 19:53 dev drwxr-xr-x. 144 root root 8192 10月 28 20:16 etc drwxr-xr-x. 3 root root 24 10月 27 20:58 home lrwxrwxrwx. 1 root root 7 10月 27 20:52 lib -> usr/lib lrwxrwxrwx. 1 root root 9 10月 27 20:52 lib64 -> usr/lib64 drwxr-xr-x. 2 root root 6 4月 10 2018 media drwxr-xr-x. 2 root root 6 4月 10 2018 mnt drwxrwxr-x. 3 wanglichao wanglichao 156 10月 28 20:30 myapp drwxrw----. 3 wanglichao wanglichao 16 10月 27 20:55 opt dr-xr-xr-x. 239 root root 0 10月 28 19:53 proc dr-xr-x---. 4 root root 203 10月 28 18:24 root drwxr-xr-x. 43 root root 1260 10月 28 19:56 run lrwxrwxrwx. 1 root root 8 10月 27 20:52 sbin -> usr/sbin drwxr-xr-x. 2 root root 6 4月 10 2018 srv dr-xr-xr-x. 13 root root 0 10月 28 19:53 sys drwxrwxrwt. 25 root root 4096 10月 28 20:30 tmp drwxr-xr-x. 14 root root 167 10月 27 21:12 usr drwxr-xr-x. 21 root root 4096 10月 27 20:59 var [root@192 /]# chown mysql:mysql -R /data/mysql [root@192 /]# cd /data/mysql [root@192 mysql]# ls [root@192 mysql]# ll 总用量 0 [root@192 mysql]# cd ../ [root@192 data]# ll 总用量 0 drwxr-xr-x. 2 mysql mysql 6 10月 28 20:35 mysql [root@192 data]# cd ../ [root@192 /]# cat /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d [root@192 /]# vim /etc/my.cnf [root@192 /]# cd myapp/software/mysql [root@192 mysql]# ls bin docs include lib LICENSE man README share support-files [root@192 mysql]# ll 总用量 272 drwxr-xr-x. 2 root root 4096 10月 28 20:28 bin drwxr-xr-x. 2 root root 55 10月 28 20:28 docs drwxr-xr-x. 3 root root 4096 10月 28 20:28 include drwxr-xr-x. 5 root root 230 10月 28 20:28 lib -rw-r--r--. 1 7161 31415 259199 9月 6 22:26 LICENSE drwxr-xr-x. 4 root root 30 10月 28 20:28 man -rw-r--r--. 1 7161 31415 566 9月 6 22:26 README drwxr-xr-x. 28 root root 4096 10月 28 20:28 share drwxr-xr-x. 2 root root 90 10月 28 20:28 support-files [root@192 mysql]# cd bin [root@192 bin]# ls innochecksum mysqladmin mysqld_multi mysqlpump mysqlxtest lz4_decompress mysqlbinlog mysqld_safe mysql_secure_installation perror myisamchk mysqlcheck mysqldump mysqlshow replace myisam_ftdump mysql_client_test_embedded mysqldumpslow mysqlslap resolveip myisamlog mysql_config mysql_embedded mysql_ssl_rsa_setup resolve_stack_dump myisampack mysql_config_editor mysqlimport mysqltest_embedded zlib_decompress my_print_defaults mysqld mysql_install_db mysql_tzinfo_to_sql mysql mysqld-debug mysql_plugin mysql_upgrade [root@192 bin]# ll 总用量 1348160 -rwxr-xr-x. 1 7161 31415 8147275 9月 7 00:47 innochecksum -rwxr-xr-x. 1 7161 31415 359769 9月 7 00:46 lz4_decompress -rwxr-xr-x. 1 7161 31415 10101581 9月 7 00:47 myisamchk -rwxr-xr-x. 1 7161 31415 9642658 9月 7 00:47 myisam_ftdump -rwxr-xr-x. 1 7161 31415 7539128 9月 7 00:47 myisamlog -rwxr-xr-x. 1 7161 31415 9769178 9月 7 00:47 myisampack -rwxr-xr-x. 1 7161 31415 7435495 9月 7 00:46 my_print_defaults -rwxr-xr-x. 1 7161 31415 10456480 9月 7 00:47 mysql -rwxr-xr-x. 1 7161 31415 9284722 9月 7 00:47 mysqladmin -rwxr-xr-x. 1 7161 31415 11275310 9月 7 00:47 mysqlbinlog -rwxr-xr-x. 1 7161 31415 9657634 9月 7 00:47 mysqlcheck -rwxr-xr-x. 1 7161 31415 219351526 9月 7 00:51 mysql_client_test_embedded -rwxr-xr-x. 1 7161 31415 5224 9月 7 00:46 mysql_config -rwxr-xr-x. 1 7161 31415 7614500 9月 7 00:47 mysql_config_editor -rwxr-xr-x. 1 7161 31415 254721363 9月 7 00:51 mysqld -rwxr-xr-x. 1 7161 31415 207846652 9月 7 00:45 mysqld-debug -rwxr-xr-x. 1 7161 31415 27118 9月 7 00:46 mysqld_multi -rwxr-xr-x. 1 7161 31415 27836 9月 7 00:46 mysqld_safe -rwxr-xr-x. 1 7161 31415 9560756 9月 7 00:47 mysqldump -rwxr-xr-x. 1 7161 31415 7844 9月 7 00:46 mysqldumpslow -rwxr-xr-x. 1 7161 31415 218929598 9月 7 00:51 mysql_embedded -rwxr-xr-x. 1 7161 31415 9307783 9月 7 00:47 mysqlimport -rwxr-xr-x. 1 7161 31415 9769188 9月 7 00:47 mysql_install_db -rwxr-xr-x. 1 7161 31415 7500392 9月 7 00:47 mysql_plugin -rwxr-xr-x. 1 7161 31415 17682531 9月 7 00:47 mysqlpump -rwxr-xr-x. 1 7161 31415 9237727 9月 7 00:47 mysql_secure_installation -rwxr-xr-x. 1 7161 31415 9245140 9月 7 00:47 mysqlshow -rwxr-xr-x. 1 7161 31415 9349690 9月 7 00:47 mysqlslap -rwxr-xr-x. 1 7161 31415 7823435 9月 7 00:46 mysql_ssl_rsa_setup -rwxr-xr-x. 1 7161 31415 218498862 9月 7 00:51 mysqltest_embedded -rwxr-xr-x. 1 7161 31415 5140450 9月 7 00:46 mysql_tzinfo_to_sql -rwxr-xr-x. 1 7161 31415 12501318 9月 7 00:47 mysql_upgrade -rwxr-xr-x. 1 7161 31415 24601564 9月 7 00:47 mysqlxtest -rwxr-xr-x. 1 7161 31415 7578442 9月 7 00:47 perror -rwxr-xr-x. 1 7161 31415 5358815 9月 7 00:46 replace -rwxr-xr-x. 1 7161 31415 7435037 9月 7 00:46 resolveip -rwxr-xr-x. 1 7161 31415 7521201 9月 7 00:46 resolve_stack_dump -rwxr-xr-x. 1 7161 31415 114075 9月 7 00:46 zlib_decompress [root@192 bin]# ./mysqld --defaults-file=/etc/my.cnf --basedir=/myapp/software/mysql/ --datadir=/data/mysql/ --user=mysql --initialize [root@192 bin]# [root@192 bin]# cat /data/mysql/mysql.err 2021-10-29T03:52:36.800587Z 0 [Warning] InnoDB: New log files created, LSN=45790 2021-10-29T03:52:36.820455Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2021-10-29T03:52:36.874433Z 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: a7c106fd-386b-11ec-a788-000c2969c071. 2021-10-29T03:52:36.875787Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2021-10-29T03:52:37.712094Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. 2021-10-29T03:52:37.712103Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. 2021-10-29T03:52:37.712627Z 0 [Warning] CA certificate ca.pem is self signed. 2021-10-29T03:52:37.914828Z 1 [Note] A temporary password is generated for root@localhost: Blfwsup7hM,t [root@192 bin]# cp /myapp/software/mysql/support-files/mysql.server /etc/init.d/mysql [root@192 bin]# service mysql start Starting MySQL. SUCCESS! [root@192 bin]# ps -ef|grep mysql root 128836 1 0 20:56 pts/0 00:00:00 /bin/sh /myapp/software/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/mysql.pid mysql 129063 128836 1 20:56 pts/0 00:00:00 /myapp/software/mysql/bin/mysqld --basedir=/myapp/software/mysql --datadir=/data/mysql --plugin-dir=/myapp/software/mysql/lib/plugin --user=mysql --log-error=/data/mysql/mysql.err --pid-file=/data/mysql/mysql.pid --socket=/tmp/mysql.sock --port=3306 root 130061 4616 0 20:56 pts/0 00:00:00 grep --color=auto mysql [root@192 bin]# ./mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [root@192 bin]# ./mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.36 Copyright (c) 2000, 2021, 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> SET PASSWORD = PASSWORD('123456'); Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (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> update user set host = '%' where user = 'root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> update user set host = '%' where user = 'mysql01'; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0 mysql>

  

posted @ 2021-10-29 13:33  消失的那两年  阅读(2129)  评论(0编辑  收藏  举报