mysql

MySQL 5.6.10 InnoDB cannot create table as table already exists

不想你离开。 提交于 2021-02-08 06:55:20
问题 I have a very interesting case. Several of my InnoDB tables got somehow corrupted. The .frm files of the tables disappeared and only the .ibd files were left. I thought no problem, I will restore these tables from the backup, so I deleted the .frm files and try to create the new tables with the same name, but every time I get "the table already exists", the .ibd file gets created, but the .frm not. Basically now I cannot create InnoDB tables with the given names in the given database. My only

Wordpress - getting images from db stored as blob data

橙三吉。 提交于 2021-02-08 06:53:22
问题 I have a form uploading to database and storing images as blob. I cannot get them to output. Upload code: $image = strip_tags(file_get_contents($_FILES['image']['tmp_name'])); $image_name = strip_tags($_FILES['image']['name']); $image_size = getimagesize($_FILES['image']['tmp_name']); if($image_size == FALSE) { echo 'An image has not been uploaded'; } else { $wpdb->insert( $table, array( 'title' => $title, 'description' => $description, 'brand' => $brand, 'img_name' => $image_name, 'img' =>

Migrations error in django 2; AttributeError: 'str' object has no attribute 'decode'

馋奶兔 提交于 2021-02-08 06:52:38
问题 I am running migrations on my newly built app called 'core'. When I run migrations on it, I get an error that tells me this; query = query.decode(errors='replace') AttributeError: 'str' object has no attribute 'decode' I am posting the Traceback below; C> python manage.py makemigrations core Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "C:\Python37\lib\site-packages\django\core

MySQL function to split strings by delimiter doens't work with Polish special characters

别来无恙 提交于 2021-02-08 06:52:37
问题 This is a function which successfully grabs single lines out of strings until it's a text with some Polish special characters DELIMITER $$ DROP FUNCTION SPLIT_STR $$ CREATE FUNCTION SPLIT_STR(x VARCHAR(1500) CHARSET utf8 COLLATE utf8_unicode_ci, delim VARCHAR(12) CHARSET utf8 COLLATE utf8_unicode_ci, pos INTEGER) RETURNS VARCHAR(500) CHARSET utf8 COLLATE utf8_unicode_ci BEGIN DECLARE output VARCHAR(1500) CHARSET utf8 COLLATE utf8_unicode_ci; SET output = REPLACE(SUBSTRING(SUBSTRING_INDEX(x,

【面经】离职10天,面了4家公司,我的感受...

為{幸葍}努か 提交于 2021-02-08 06:39:46
http://dy.163.com/v2/article/detail/F75J5CHO0511Q1AF.html    20 大进阶架构专题每日送达      作者:莫那鲁道   来源:http://1t.click/U4g   楼主离职已有 10 天,这段时间里除了看源码,就是投简历面试了。一共面试了 4 家,说说感受。    XX 汇   XX 汇是一家小型的电商网站,由于楼主的技术栈集中在 Java 语言这里,所以,即使楼主对并发,JVM,Netty,Spring 等都稍有了解,但依然没有任何优势—— 因为他们完全用不到。   整个面试过程中,问了大概以下问题:   1.说说你的项目,用了 SpringCloud 哪些功能?   2.熟悉 Mysql 吗?说说索引(不懂 Mysql 啊大佬)   3.如何实现一个单例模式(这个俺擅长)   4.平时使用了哪些线程池(这个俺也擅长)   5.Map 接口有哪些类(这个俺也擅长)   6.写一段 SQL 呗(不会 SQL)   7.如何实现免登陆功能(cookie session?)   当然,被刷了,估计是 SQL 不够好吧,而我擅长的他们也不需要。    XX 旅游   这个就比较奇葩了,是最奇葩的一个,面试官是个小伙子,根本不懂并发,然后强行问我并发,自己基本一言不发。还对我的回答貌似不满意?   1.自我介绍一下。  

vserver phpmyadmin error on every password change

痞子三分冷 提交于 2021-02-08 06:35:35
问题 I installed Phpmyadmin and MySQL with apache2 to my Vserver, but Im getting on Every Password change this error mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@'localhost' (using password: YES) and this Connection for controluser as defined in your configuration failed. what is here the Problem? 回答1: The phpMyAdmin application has a set of additional features that can be enabled by creating an additional user (called the controluser); those features include things

Centos7安装PHP、安装MySQL、安装apache

怎甘沉沦 提交于 2021-02-08 06:26:27
Centos7 安装 PHP 、 MySQL 、 apache 这里今天教大家如何在 centos7 安装 PHP , apache , mysql 。 首先我们需要先安装 centos7 ,我们可以在我们的电脑上安装一个虚拟机,在里面装 centos7 ,在 win10 里安装 centos7 可以看我的上一篇博客: https://www.cnblogs.com/shengChristine/p/9284969.html 我们也可以购买阿里云、腾讯云等的云服务器,下面是我购买的阿里云的服务器(最低配的)。 这次的教程就是使用这个服务器。如果只是用来学习的话,就不需要自己现在电脑里安装一个。 服务器有了,我们怎么来操作这个服务器你。这里我们 windows 系统需要用的一个软件,就是 PuTTY (可以自行百度下载),除了这个还可用其他的虚拟终端,比如 xshell 。如果是 linux 系统的可以忽略。 打开 putty ,按照下面的要求填写好信息,然后 open 。 Open 之后会弹出下面的终端,输入用户名和密码进行登录。 打开之后我们就来安装 PHP 吧,这里装的是 PHP7.0 版本 1 、安装 epel-release 输入指令:yum -y install epel-release 回车等待安装成功 2、 安装 PHP7.0 首先我们先来获取 PHP7.0 的

How do I create permalinks that are database driven?

我的未来我决定 提交于 2021-02-08 06:14:36
问题 I'm looking for a way to translate http://www.mysite.com/articles.php?id=1 into http://www.mysite.com/articles/name_of_article_from_field_in_database_with_id_1 I'm ok with doing some sort of RewriteRule with Mod Rewrite, but I'm not sure how to do it exactly. My pages are coded in PHP pulling from a MySQL database. Hopefully someone can tell me how to do this! I know there are others looking for a similar answer. Thanks again! NCoder 回答1: You're going to need a rewrite rule in your web server

Multiple queries dependent on each other

China☆狼群 提交于 2021-02-08 06:09:55
问题 I have two queries both dependent on each other, i.e. if first query is not executed the second shouldn't be executed, and the other way around if second can't be executed the first shouldn't be executed. INSERT INTO `table` VALUES (1,2,3) UPDATE `otherTable` SET `val1`=1 WHERE `id`=$idOfInsert ON DUPLICATE KEY UPDATE is not the answer. I tried using mysqli::multi_query but as it turned out it executes the first even though the second can't be executed (it stops on error). How can I achieve

Multiple queries dependent on each other

£可爱£侵袭症+ 提交于 2021-02-08 06:09:27
问题 I have two queries both dependent on each other, i.e. if first query is not executed the second shouldn't be executed, and the other way around if second can't be executed the first shouldn't be executed. INSERT INTO `table` VALUES (1,2,3) UPDATE `otherTable` SET `val1`=1 WHERE `id`=$idOfInsert ON DUPLICATE KEY UPDATE is not the answer. I tried using mysqli::multi_query but as it turned out it executes the first even though the second can't be executed (it stops on error). How can I achieve