赞
踩
安装wordpress需要用到mysql,termux有官方提供mariadb,
那就可以用这个mariadb替代mysql做为wordpress的数据库
1. 安装mariadb: pkg install mariadb
安装完之后默认会有两个密码为空的账号:root 和 u0_a205(当前用户)
2. 打开链接数据库:mysql -u u0_a205 -p
- ~ $ whoami
- u0_a205
- ~ $ mysql -u u0_a205 -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 5
- Server version: 10.6.4-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)]>
3 . 创建wordpress数据:create database wordpress;show databases;
- MariaDB [(none)]> create database wordpress;show databases;
- Query OK, 1 row affected (0.001 sec)
-
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- | sys |
- | test |
- | wordpress |
- +--------------------+
- 6 rows in set (0.002 sec)
4. 创建一个root1 密码为root的用户。(用户名和密码都随意主要是用户的权限,默认的两个用户只能localhost链接,不够用。)
GRANT ALL PRIVILEGES ON *.* TO 'root1'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
- MariaDB [(none)]> 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
- MariaDB [mysql]> SELECT user,host,Password FROM mysql.user;
- +-------------+-----------+----------+
- | User | Host | Password |
- +-------------+-----------+----------+
- | mariadb.sys | localhost | |
- | root | localhost | invalid |
- | u0_a205 | localhost | invalid |
- | | localhost | |
- +-------------+-----------+----------+
- 4 rows in set (0.003 sec)
- MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root1'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
- Query OK, 0 rows affected (0.004 sec)
-
- MariaDB [mysql]> SELECT user,host,Password FROM mysql.user;
- +-------------+-----------+-------------------------------------------+
- | User | Host | Password |
- +-------------+-----------+-------------------------------------------+
- | mariadb.sys | localhost | |
- | root | localhost | invalid |
- | u0_a205 | localhost | invalid |
- | | localhost | |
- | root1 | % | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
- +-------------+-----------+-------------------------------------------+
- 5 rows in set (0.003 sec)
-
- MariaDB [mysql]>
到这里 数据库部分准备完成,
1. 下载单前最新wordpress5.9版本代码,并且解压到nginx相关目录。
- wget https://cn.wordpress.org/wordpress-5.9-zh_CN.zip
- unzip wordpress-5.9-zh_CN.zip -d $PREFIX/share/nginx/html && cd $PREFIX/share/nginx/html/wordpress && chmod -Rf 777 ./*
这里可以新起一个终端通过ssh链接到termux
2 . 打开链接进入安装页面 :http://192.168.9.101:8080/wordpress/
使用之前新建了的数据库,和用户名密码,主机这里用localhost不好使,换成对应ip
如果要用弱密码,就会多一个确认项。
安装成功登录
1. 一些命令相关:
启动数据库:mysqld_safe -u root &
- mysql -u u0_a205 -p # 密码为空的时候提示输密码时直接回车
- show databases; # 查看数据库
- use mysql; # 使用mysql库
- SELECT user,host,Password FROM mysql.user; # 查看用户部分信息
- GRANT ALL PRIVILEGES ON *.* TO 'root1'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; #创建用户名root1密码为root,%不限制链接,有全部权限的用户
2. Adminer 数据库管理
2.1 下载adminer-4.8.1.php源码并且移动到nginx对应目录
- wget https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php
- mv adminer-4.8.1.php $PREFIX/share/nginx/html/
2.2 打开数据库管理软件:http://192.168.9.101:8080/adminer-4.8.1.php
能正常图形话查看和管理数据库了。
3.termux安装kodbox-方便简单图形界面操作_xnllc的专栏-CSDN博客
使用之前安装好的kodbox直接管理相关代码。最为方便快捷。
直接去官网下载 wordpress,phpMyAdmin,adminer等代码直接图形化上传到对应nginx目录。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。