SilverStripe FulltextSearch causing database error - silverstripe

I'm following this tutorial:
https://www.cwp.govt.nz/guides/core-technical-documentation/framework/en/tutorials/4-site-search
I've finished the first step of adding FulltextSearchable::enable(); to mysite/_config.php. I then run the dev/build as suggested but instead of completing successfully, I get this error:
[User Error] Couldn't run query: ALTER TABLE "File" ADD fulltext
"SearchFields" ("Filename","Title","Content") The used table type
doesn't support FULLTEXT indexes
Google tells me that my MySQL database is in the incorrect format. However SilverStripe automatically generates a database for you. I could change the database format, but I don't think changing the database format is the correct approach here as other users appear to have the module working.
Any help would be appreciated.

As far as my memory serves me right SilverStripe creates the tables as InnoDB. MySQL 5.5 documentation says that FULLTEXT indexes are supported by MyISAM tables. InnoDB support for FULLTEXT indexes comes in 5.6.
Full-text indexes can be used only with MyISAM tables. (In MySQL 5.6 and up, they can also be used with InnoDB tables.)
You need to change your tables to MyISAM or update MySQL.
Here is a good guide for changing table types. In case the site goes down, here are the good points:
Steps to follow:
Take backup of Mysql database.
Run this sql query via terminal or in phpmyadmin for the database which you wish to convert into MYISAM.
mysql -u username -p -e "SELECT concat('ALTER TABLE ', TABLE_NAME,' ENGINE=MYISAM;') FROM Information_schema.TABLES WHERE TABLE_SCHEMA = 'db_name' AND ENGINE = 'InnoDB' AND TABLE_TYPE = 'BASE TABLE'" | tail -n+2 >> alter.sql
Note: Change db_name with your actual database name
Import that alter.sql file into INNODB database
EDIT: Of course you can only change those tables that need to be FULLTEXT indexed.

Related

How WordPress select database engine while installing website?

Is this default database storage engine? I want to install my WordPress website with MYSQL "NDB CLUSTER" storage engine. I tried to install wordpress site, but it's installed with InnoDB. Please help me to resolve this.
I used this SET storage_engine=NDBCLUSTER; in mysql.
There are two ways to migrate InnoDB tables with foreign keys to NDB.
Dump the database and edit the script so each table specifies ENGINE=NDB before re-importing the script to a new database
Drop the constraints, alter the tables to use the NDB engine, and recreate the constraints
Dumping the database and editing the script is a straightforward use of mysqldump and a text editor.
Converting InnoDB Tables to MySQL Cluster
it might helpful for you

MySQL InnoDB: cannot calculate statistics because the .ibd file is missing

Environment:
Windows 7 (XAMPP latest)
Apache 2.4.4
PHP 5.5
MySQL 5.6.11
I am trying to backup a database from MySQL 5.1 and import it to MySQL 5.6.
In MySQL 5.1, there are some MyISAM and InnoDB tables. I use mysqldump to dump the SQL file out, with --add-drop-database switch.
Now when I go back to my localhost and import the SQL file using MySQL workbench, an error occur:
InnoDB: cannot calculate statistics for table "database"."tables" because the .ibd file is missing.
I tried drop the database using:
drop schema database
And it crashes the MySQL 5.6, with error like this:
2013-09-10 17:18:23 fc4 InnoDB: Warning: MySQL is trying to drop database `database`.``
InnoDB: though there are still open handles to table `database`.`table`.
In my.ini I set:
innodb_force_recovery = 4
I tried:
Create a new database with different database name and run the import again, all innodb tables cannot be created.
Copy all *.frm tables from a working 5.1 server in data directory, overwrite existing database, restart MySQL 5.6.11, all innodb tables cannot be accessed.
If I run a create table statement with engine=InnoDB, it will failed and said table already exists, which actually it does not exists.
If I run a drop table statement that using InnoDB, it will say table does not exists...
Can anyone please give me some advices on it?
Thank you.
It turns out that it seems to be a MySQL 5.6.11 problem, I change MySQL to 5.5.30 and it all works well.
I had a similar problem on Mac OS X, but in a slightly bizarre way: I was running fine on some pre-5.6.19 version and then upgraded to 5.6.19, which started to give me the error message above, except none of my tables use mixed case.
As it turned out, one of my databases is using an uppercase character as its first letter. This has worked fine for a long time, but failed this morning after the minor version upgrade and sent me into a 2-hour search for what went wrong.
The fix is simple: create a symlink with the lower case version, restart mysqld and all is well. However, even though I understand the logic for making tables case-safe, there is no danger of the database name being ambiguous since the OS would always prevent that.

How to know what table there are in a sqlite file?

I have a sqlite file but I don't know what tables there are in it and thus I can't use a SELECT query.
So, is there a way to know what table are in it ?
P.S. I am under Ubuntu Linux and I have already installed sqlite3 from shell.
You can open the database using sqlite3 using:
sqlite3 <databasefile>
Once in the sqlite3 shell you can simply type:
.tables
to see a list of all the tables.
You can see the table structure of a particular table using:
.schema <tablename>
You can also omit the table name to see the schema for the whole database.
Information about these commands and more can be seen by typing:
.help

Creating Databases and Tables using SQLite3

I have used SQLIte3 to create databases and then added tables to it. Then i closed the terminal and reopened it.
I typed the command sqlite3, and typed select * from tableName; It says the table is not found.
Think i have to select the database first and then type the above select statement to work. So how can i do that ?
SQL commands like show databases; is not recognized.
You have to write sqlite3 DB_NAME on terminal to open database. Then you can see sqlite prompt like sqlite3> You can enter command select * from tableName there, so that your tables will be listed. You can also try .schema command to see the schema of your data base. Refer the site http://www.sqlite.org/ for more details.
You can use SQLite Manager firefox add-on to view sqlite database, table and execute query there.

Accessing .sqlite db from phpmyadmin? FF cookies

I'm trying to view my firefox cookies db (cookies.sqlite). Since I've never accessed dbs with anything other than phpmyadmin, I'm at a loss as to how to view the content of this sqlite file. There's localhost/sqlitemanager, but I'd rather stick to the phpmyadmin interface that I'm used to.
Any ideas how I can open/view this sqlite db the normal way in phpmyadmin? Is it possible?
Thanks in advance
P.S. I know that browser cookies are very commonly accessed/played with. If you know another tool that's more specific for this goal, please drop me an answer or suggest in the comments.
There are also several web interfaces for sqlite.
phpSQLiteAdmin
SQLiteManager
Simple SQLite Manager
SQLite Admin
WizSQLiteAdmin
ezSqliteAdmin
SQLiteWebAdmin
knoda
I have not yet tried any of them - in fact, I found this SO question while researching sqlite web front-ends for my own use. But I, too, come from a phpMyAdmin background, so the first one I plan to try is phpSQLiteAdmin.
I imagine there are various GUI programs that will hold your hand. However, I'm going to show you what I would do if I was interested in table moz_cookies in db cookies.sqlite.
$
$ sqlite3 cookies.sqlite
SQLite version 3.5.9
Enter ".help" for instructions
sqlite> .schema
CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER);
sqlite> select * from moz_cookies limit 1;
1248713741170186|PREF|ID=12d44375be9e7c86:U=d07dae1b87f4537c:LD=en:NR=100:TM=1248713740:LM=1254091506:FV=2:IG=3:S=Jdo_PXt92J5ojL6E|.google.com|/|1317163505|1255144201180851|0|0
sqlite>
You may want the sqlite3 CLI program. It is available on Unix and Windows.
SQLITE3(1) SQLITE3(1)
NAME
sqlite3 - A command line interface for SQLite version 3
SYNOPSIS
sqlite3 [options] [databasefile] [SQL]
SUMMARY
sqlite3 is a terminal-based front-end to the SQLite library that can
evaluate queries interactively and display the results in multiple for‐
mats. sqlite3 can also be used within shell scripts and other applica‐
tions to provide batch processing features.
DESCRIPTION
To start a sqlite3 interactive session, invoke the sqlite3 command and
optionally provide the name of a database file. If the database file
does not exist, it will be created. If the database file does exist,
it will be opened.
It has two categories of operations.
Commands intended directly for the interactive shell begin with .. Anything is an SQL query terminated as usual with ;.
Adminer is a PHPMyAdmin-like system that has support for MySQL, PostgreSQL, SQLite, MS SQL, Oracle, SimpleDB, Elasticsearch, MongoDB, etc.

Resources