mysql初始化

[root@bogon data]# cd /data/mysql
[root@bogon mysql]# ll
总用量 308
drwxr-xr-x.  2 7161 31415   4096 7月  13 08:22 bin
drwxr-xr-x.  2 7161 31415   4096 7月  13 08:22 docs
drwxr-xr-x.  3 7161 31415   4096 7月  13 08:22 include
drwxr-xr-x.  6 7161 31415   4096 7月  13 08:22 lib
-rw-r--r--.  1 7161 31415 282186 7月  13 03:15 LICENSE
drwxr-xr-x.  4 7161 31415   4096 7月  13 08:22 man
-rw-r--r--.  1 7161 31415    666 7月  13 03:15 README
drwxr-xr-x. 28 7161 31415   4096 7月  13 08:22 share
drwxr-xr-x.  2 7161 31415   4096 7月  13 08:22 support-files
[root@bogon mysql]# cd bin/
[root@bogon bin]# ./mysqld --initialize-insecure --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data
2024-07-24T06:01:11.598068Z 0 [Warning] [MY-011070] [Server] 'binlog_format' is deprecated and will be removed in a future release.
2024-07-24T06:01:11.598077Z 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2024-07-24T06:01:11.598203Z 0 [System] [MY-013169] [Server] /data/mysql/bin/mysqld (mysqld 8.0.39) initializing of server in progress as process 4353
2024-07-24T06:01:11.607885Z 0 [Warning] [MY-013907] [InnoDB] Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to compute innodb_redo_log_capacity=1073741824. Please use innodb_redo_log_capacity instead.
2024-07-24T06:01:11.610050Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-07-24T06:01:17.171717Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-07-24T06:01:20.161187Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
[root@bogon bin]# service mysqld  start 
Starting MySQL.Logging to '/data/mysql/data/bogon.err'.
...... SUCCESS! 
[root@bogon 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.39 MySQL Community Server - GPL

Copyright (c) 2000, 2024, 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 by '123!';
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye
[root@bogon bin]# mysql -uroot -p123!
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.39 MySQL Community Server - GPL

Copyright (c) 2000, 2024, 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> 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> 
mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> exit
Bye
[root@bogon bin]# service mysqld  restart
Shutting down MySQL... SUCCESS! 
Starting MySQL....... SUCCESS! 
[root@bogon bin]# mysql -uroot -p123!

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值