~ $ mysqld mysqld: Deprecated program name. It will be removed in a future release, use '/data/data/com.termux/files/usr/bin/mariadbd' instead 2024-07-16 17:43:38 0 [Note] Starting MariaDB 11.1.2-MariaDB source revision 9bc25d98209df6810f7a7d5e7dd3ae677a313ab5 as process 13403 2024-07-16 17:43:38 0 [Note] InnoDB: Compressed tables use zlib 1.3 2024-07-16 17:43:38 0 [Note] InnoDB: Number of transaction pools: 1 2024-07-16 17:43:38 0 [Note] InnoDB: Using generic crc32 instructions 2024-07-16 17:43:38 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB 2024-07-16 17:43:38 0 [Note] InnoDB: Completed initialization of buffer pool 2024-07-16 17:43:39 0 [Note] InnoDB: Buffered log writes (block size=512 bytes) 2024-07-16 17:43:39 0 [Note] InnoDB: End of log at LSN=47311 2024-07-16 17:43:39 0 [Note] InnoDB: Opened 3 undo tablespaces 2024-07-16 17:43:39 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active. 2024-07-16 17:43:39 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ... 2024-07-16 17:43:39 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB. 2024-07-16 17:43:39 0 [Note] InnoDB: log sequence number 47311; transaction id 14 2024-07-16 17:43:39 0 [Note] InnoDB: Loading buffer pool(s) from /data/data/com.termux/files/usr/var/lib/mysql/ib_buffer_pool 2024-07-16 17:43:39 0 [Note] Plugin 'FEEDBACK' is disabled. 2024-07-16 17:43:39 0 [Note] Server socket created on IP: '::'. 2024-07-16 17:43:39 0 [Note] Server socket created on IP: '0.0.0.0'. 2024-07-16 17:43:39 0 [Note] mysqld: Event Scheduler: Loaded 0 events 2024-07-16 17:43:39 0 [Note] InnoDB: Buffer pool(s) load completed at 240716 17:43:39 2024-07-16 17:43:39 0 [Note] mysqld: ready for connections. Version: '11.1.2-MariaDB' socket: '/data/data/com.termux/files/usr/var/run/mysqld.sock' port: 3306 MariaDB Server
访问数据库
数据库访问
1
mysql -uroot -p
输入后不用输入密码直接回车就好,默认是没有密码的。
登陆后的输出结果:
1 2 3 4 5 6 7 8 9 10 11 12 13
~ $ mysql -uroot -p mysql: Deprecated program name. It will be removed in a future release, use '/data/data/com.termux/files/usr/bin/mariadb' instead Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 11.1.2-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
设置密码
输入命令:
1
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
输出结果:
1 2
MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.050 sec)
开启远程访问
方法一:
允许所有主机连接,在mysql的时候我们通常使用一下命令来开启
1 2 3
use mysql; update user set Host='%' where User='root'; flush privileges;
无疑例外的会出现错误
1
1356 - View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them