标签 mysql 下的文章

magento2 - 安装报错 - You do not have the SUPER privilege and binary logging is enabled

环境:nginx,php7.3,mysql5.7,magento2.3.4的tgz包。

通过浏览器安装magento2时,报错:You do not have the SUPER privilege and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable)

尝试:以root用户连接到mysql命令台,执行 set global log_bin_trust_function_creators=1;

参考:https://magento.stackexchange.com/questions/144713/magento-2-1-data-migration-super-privilege-error

CentOS 8 里安装 mysql 5.7

CentOS 8里,默认是安装MariaDB,Oracle仅提供MySQL 8的yum源。如需安装MySQL 5.7,可手动创建yum源配置文件,内容与CentOS 7的一样。

1.dnf module disable mysql # 禁用默认的mysql安装源

2.vi /etc/yum.repos.d/mysql-community.repo # 创建yum安装源文件,内容如下:

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0

[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
enabled=1
gpgcheck=0

[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/
enabled=1
gpgcheck=0

3.dnf --enablerepo=mysql57-community install mysql-community-server # 安装 mysql 5.7

4.systemctl enable --now mysqld.service # 启动 mysql

5.grep 'A temporary password' /var/log/mysqld.log |tail -1 # 查看自动生成的mysql的root账户密码

6.mysql_secure_installation # 初始化mysql的安全设置

参考:https://unix.stackexchange.com/questions/555285/installing-mysql-5-7-on-centos-8

magento - inventory_stock_1 doest exist - 导入数据库时需注意用户权限

现象:在原网站,以mysql的root用户,通过mysqldump导出magento2的数据库文件。将导出的数据库文件导入到cPanel空间的数据库。访问cPanel空间的站点,提示出错:

2 exception(s):
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'aqtest.inventory_stock_1' doesn't exist, query was: SELECT COUNT(DISTINCT e.entity_id) FROM `catalog_product_entity` AS

尝试:编辑导出的magento2数据库文件,将原

DEFINER=`root`@`localhost`

替换为现数据库用户,如

DEFINER=`aqtest`@`localhost`

,最后重新导入。

参考:https://magento.stackexchange.com/questions/259534/inventory-stock-1-doest-exist-on-magento-2-3

Linux - 重置mysql数据库的root用户密码

需求:忘记了mysql数据库root用户的密码,需要重置。

尝试:

1.service mysqld stop # 以系统的root用户登录后,执行命令,停止mysql的服务

2.mysqld_safe --skip-grant-tables & # 以带参数skip-grant-tables的命令,跳过权限,启动mysql服务

3.mysql # 连接到mysql控制台

4.UPDATE mysql.user SET Password=PASSWORD('NEW-PASSWORD') WHERE User='root'; # 设置mysql用户的新密码是 NEW-PASSWORD

5.ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEW-PASSWORD'; #如果是mysql 5.7.6以后的版本,请用这个命令代替

6.service mysqld stop # 停止mysql服务

7.service mysqld start # 再次启动,不带参数,正常启动

参考:

openlitespeed安装php56-mysql出现版本不匹配的问题

场景:在CentOS7里安装openlitespeed,配置php5.6。测试使用mysql站点的网站程序时,页头会显示:Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50560 Library:50637

过程:

1.在phpinfo信息页会显示 mysql Client API version - 5.6.37
openlitespeed-mysql-version-1.png

2.yum remove lsphp56-mysql # 删除 lsphp56-mysql

3.yum install lsphp56-mysqlnd # 安装 lsphp56-mysqlnd

4./usr/local/lsws/bin/lswsctrl restart # 重启 openlitespeed

5.在phpinfo信息页显示的是 mysql Client API version - mysqlnd 5.0.11-dev - 20120503
openlitespeed-mysql-version-2.png

5.再次测试网站程序,不会提示mysql版本不匹配的警告信息了

参考: