mysql

mysqld_safe Disabled Internet Connection

I was trying to get mysql running on my machine and ran sudo mysqld_safe from my home directory. This, I have found, was not a wise decision. Anyone have any idea what it might have changed to make reaching the internet impossible? My wireless card works fine and connects to the router, but I cannot resolve any external host (localhost w...

mysql full text search with null columns

I am trying to get a full text search on a mysql database. The problem is that some of the fields can be left null. For example I have a basic address table with columns StreetLine1 StreetLine2 City State Zip Now none of these are going to be required so any one of them could be null. When I do my full text sear...

Why does the cardinality of an index in MySQL remain unchanged when I add a new index?

I have added a FULLTEXT index to one of my MySQL database tables as follows: ALTER TABLE members ADD FULLTEXT(about,fname,lname,job_title); The problem is that using phpmyadmin I can see the cardinality of my new index is only 1. Does this mean the index will never be used? I have run a analyze table command but it didn't seem to do ...

Starting with versioning mysql schemata without overkill. Good solutions?

I've arrived at the point where I realise that I must start versioning my database schemata and changes. I consequently read the existing posts on SO about that topic but I'm not sure how to proceed. I'm basically a one man company and not long ago I didn't even use version control for my code. I'm on a windows environment, using Aptana...

Batch script to issue commands to mySQL db?

I am trying to create a batch script that would connect to a mySQL database and issue a delete command: @echo off echo Resetting all assessments... mysql -hlocalhost -urdfdev -p%1 rdf_feedback delete from competency_question_answer; I will run this script providing the password as a command-line argument, but all this script does is, ...

Basics of Foreign Keys in MySQL?

Is there any good explanation of how to use MySQL's foreign key construct? I don't quite get it from the MySQL docs themselves. Up until now I've been handling things like foreign keys with joins and programming code. And the second part of the question, are there any improvements to be made by using MySQL's inbuilt foreign keys? ...

Connect web server with database and J2ME

I do a mobile application which the user can use it get the required place’s number. The user must select the appropriate city and category to get the place’s information. All the information stored in the database. What I want to know that .. 1) What is the benefit from the web service? 2) How to connect the web service and MySQ...

Can anyone explain this MySQL error?

ERROR 1025 (HY000): Error on rename of '.\forumf\#sql-1718_20' to '.\forumf\posts' (errno: 150) Is the error number 1025 or 150? I was deleting a primary key (which I had set by mistake) which was also a foreign key at the time. What is HY000? I got this quite cryptic error message while editing keys on a MySQL table. Can someone ex...

Ruby on Rails cannot connect to database from runner script

In my application I have a runner script running on schedule (crontab) that needs to connect to database and get some information. I get the following error when I try to run a query ( using Model.find(...) ) : .../vendor/rails/railties/lib/commands/runner.rb:45: .../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_...

Access remote sql server using VB.NET

I've found a few examples of using vb.net to access an sql database, so far none of them have worked . They all involve using DataReaders. Maybe its the fact that the sql db is not on the same machine as the application. I was just wondering if anyone had a more comprehensive example of using VB.NET to access a remote sql server. Thank...

ordering a table in Mysql, according to another, but without seeing repetitive rows of the first table

In MySql, I have two tables, A and B. A has as columns A.id, B has as columns B.id and B.aid. or each row of A I have many rows of B. And the value of B.aid=A.id of course. Now I need to get a list of the values in A, but I need to order them, according to B. In particular if I have two rows in A: a1 and a2. Each will have a series...

Allowed memory size exhausted during non-PHP MySQL import.

When I try to import a large SQL backup using the command: mysql -u ***** -p***** nxtpp < backup.sql I get the following error message after the backup is partially executed: Allowed memory size of 33554432 bytes exhausted I already know about the memory_limit variable in php.ini, but the problem is that I am not using PHP to impor...

Python: MySQLdb Connection Problems

I'm having trouble with the MySQLdb module. db = MySQLdb.connect( host = 'localhost', user = 'root', passwd = '', db = 'testdb', port = 3000) (I'm using a custom port) the error I get is: Error 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Which doesn't make much se...

Referencing foreign keys in the same column

I'm designing a bd-scheme for mysql. My db stores 3 kinds of points: a, b or c and a path is composed by n pair of points: Route = [ (a1 or b1 or c1 ; a2 or b2 or c2), (a2 or b2 or c2 ; a3 or b3 or c3), ...] create table a_points ( point_id serial not null, owner_id bigint unsigned not null, name varchar(20) not null, ...

is this at least mildly secure php code?

I have a BUNCH of $_POST variables being sent in via a long form and instead of hard coding each one with a mysql_escape_string() is it ok for me to do the following? I don't know if this is actually safe and/or viable code. foreach ($_POST as &$post_item){ $post_item = mysql_escape_string($post_item); } I'm fairly certain that be...

Phpmyadmin Mysql error

I have debian server. My phpmyadmin & mysql through command line was earlier working well. But suddenly i am getting this error while accessing phpmyadmin. http://myserver/phpmyadmin 2003 - The server is not responding And when i try to access through command line mysql -u userid -p Enter password: ERROR 1045 (28000): Access de...

MySQL Fulltext index with Rails 2.3.2 (migration problem)

Hi, I'm using MySQL fulltext indexes in a Rails 2.3.2 App. I added the index via native SQL in my migration. But there is a known issue causing problems with the schema.rb. Rails doesn't understand fulltext indexes and tries to create a normal index. This will cause an error when creating the database from schema.rb (eg testing, specs, ...

How to implement a Keyword Search in MySQL?

HI all, I am really a new sq l programmer, can some one help me in solving this. I have a table job where the fields are id,position,category,location,salary range, description, refno. I want to implement a keyword search from the front end. The keyword can be reside in any of the field of the said table. ...

How to fetch current year and month from MySQL in JAVA?

Hi, I want to fetch the records from MySQL for the current year and month. I am passing to get the today records Today: ("recDate","=", new Date()); Like that, how to fetch for current Month and current Year ? Thanks in advance Gnaniyar Zubair ...

Map raw SQL to multiple related Django models

Due to performance reasons I can't use the ORM query methods of Django and I have to use raw SQL for some complex questions. I want to find a way to map the results of a SQL query to several models. I know I can use the following statement to map the query results to one model, but I can't figure how to use it to be able to map to relat...