|
前提条件:
1、首先环境中已经安装了entware
可选项:
扩展opt目录大小
1、 通过dd命令在/tmp/share/sda1目录下创建一个4G大小的文件opt.raw
dd if=/dev/zero of=opt.raw bs=1024k count=4096
2、 安装文件系统工具集e2fsprogs
opkg install e2fsprogs
3、通过mke2fs 命令为opt.raw文件创建文件系统
mke2fs -t ext4 opt.raw
4、通过mount命令,将opt.raw盘挂载道/opt 目录下
mount /tmp/share/sda1/opt.raw /opt
此时需要重新安装entware
mariadb安装:
1、opkg install mariadb-server mariadb-client
2、此时需要启动mariadb服务
a. [K3 /tmp/media/nand/opt/etc/init.d]# ./S70mariadbd start
[K3 /tmp/media/nand/opt/etc/init.d]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/tmp/mysql.sock' (2)
这里报错是由于mariadb服务没有起来,查看启动脚本S70mariadbd 可以看到执行了如下命令
直接执行/opt/bin/mysqld --pid-file=/opt/var/run/mysqld.pid 会报如下错误
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
从报错上来看,是由于缺少了mysql.plugin表所致的,不过现在连启动都启动不了,怎样创建表呢?所以肯定是其他原因导致的,于时继续网上找继续试,最后找到了这个处理方法,进入mysql安装后的目录scripts执行以下语句:
来自 <https://blog.csdn.net/u010860214/article/details/49448003>
b. 此时执行[K3 /tmp/media/nand/opt/bin]# /opt/bin/mysql_install_db
报错如下:
/opt/bin/mysql_install_db: line 342: hostname: not found
chown: unknown user root
Cannot change ownership of the database directories to the 'root'
c. 此时需要更改配置文件/opt/etc/mysql/my.cnf中字段
[mysqld]
user = root
更改user = admin
d. 此时再次执行/opt/bin/mysql_install_db
e. /tmp/media/nand/opt/etc/init.d]# ./S70mariadbd start
3、此时mariadb已经起来,可以对数据库进行操作了。 |
|