mysql

Mysql replications: slave is not readonly

Hi! After setting up mysql replications with master/slave db scheme, I noticed that the slave db server is not read-only. Of cause, after that I configured it manually in /etc/my.cnf file. I just can't understand: isn't it the default behavior that the slaves are always running in the read-only mode or it should be always configured by ...

Mysqlhotcopy Problem: DBD::mysql::db do failed: Out of resources when opening file

When trying to do a snapshot with mysqlhotcopy, i got this: root@dev2 /home/backups # mysqlhotcopy -u root -p xxx dbname --allowold /home/backups/ DBD::mysql::db do failed: Out of resources when opening file './dbname/table.MYD' (Errcode: 24) at /usr/bin/mysqlhotcopy line 452. is there any solution (except replication)? database's siz...

SELECT to get two entries, from same table, differentiated by date, in one row

I have a table in which i keep different meters (water meter, electricity meter) and in another table i keep the readings for each meter. The table structure is like this : The meter table MeterID | MeterType | MeterName The readings Table: ReadingID | MeterID | Index | DateOfReading The readings for a meter are read monthly. The t...

MySQL table structure question.

I have a table that holds a users favorite categories and I was wondering if My MYSQL tables structure is built correctly to hold the MySQL data provided correctly? MySQL data. userID catID 4 21 4 4 4 67 3 34 3 4 MySQL table . CREATE TABLE ab ( userID INT UNSIGNED NOT NULL, catID INT UNSIGNED NOT...

Read data from multiple rows PHP MySQL

I have a database to keep track of the services clients have. But need to be able to find all the services (on different rows) and display them in an HTML table. i.e. Service Company Status ------------------------------------- Service 1 Company 1 Complete Service 2 Company 2 Pending Service 3 Company 1 ...

How to hide SQL queries from web browsers (PHP)

Hi, I'm new to this forum and have a dilemma with my MySQL/PHP site. Now I've created a function that will pass a SQL query to it and execute it. What I didn't account for was the fact my SQL query being passed to the function is showing up in the "view source" of all browsers; which is BIG security concern because hackers can see the ...

Only Know Password for One MySQL Login, Need to Reset Other Login...How?

I have access to the lesser account. I want the password to the All Privileges account. I've tried a few options but can't seem to get the password to reset. Suggestions? I'm also on Twitter asking for help... @BrentDPayne Thanks, Brent D. Payne ...

MySQL Cast NULL to integer 0

Hello. How can I cast something that returns NULL to 0? If this is my query: select col from table; would this be the right way to do it: select cast(col as unsigned integer) from table;? Thank you. ...

Query for new replies on a comment table?

I have a standard comment_id/comment_parent_id setup on my mysql comments table (with a created timestamp). My question is what is the least process intensive query to get all NEW replies on a user's comment? Just like with the commenting systems that use a checkbox to email replies to your comment? Do you cookie a timestamp for last ...

MySQL: Can't create table (errno: 150)

I am trying to import a .sql file and its failing on creating tables. Here's the query that fails: CREATE TABLE `data` ( `id` int(10) unsigned NOT NULL, `name` varchar(100) NOT NULL, `value` varchar(15) NOT NULL, UNIQUE KEY `id` (`id`,`name`), CONSTRAINT `data_ibfk_1` FOREIGN KEY (`id`) REFERENCES `keywords` (`id`) ON DELETE CASCADE ON...

Django code or MySQL triggers

Hi. I'm making a web service with Django that uses MySQL database. Clients interface with our database through URLs, handled by Django. Right now I'm trying to create a behavior that automatically does some checking/logging whenever a certain table is modified, which naturally means MySQL triggers. However I can also do this in Django, i...

MYSQL Select to file

I'd like to save the output from a "Select * FROM table1" in console to a file in PHP. What would be the most efficient way to do this in php? Edit: I'd like the output to be like the type in the console ie. +--------+--------+ | thing1 | thing2 | +--------+--------+ | item1a | item2a | | item1b | item2b | +--------+--------+ Also, ...

Determine if returning nothing.. PHP MySQL

I have the following code: <table> <thead> <tr> <th>Service</th> <th>Status</th> </tr> </thead> <?php $result = mysql_query("SELECT Service, Status FROM services WHERE Company='Company 1'"); while ($row = mysql_fetch_array($result)) { // ^ must be a single '=' !!!! echo '<tr><td>' . $row["Service"] . '</td...

Control panel for Sphinx?

n00b here Is there some kind of control panel for Sphinx (to make things easier)? Or is there a way I can use Plesk to handle it? I already installed (sphinx-0.9.9) on my CentOS, I just don't know what to do next to index and search on MySql (with php) Also, can someone explain about using the daemon, api, etc... ...

How to check whether a function/keyword is a valid mysql function/keyword?

Is there any alternative checking technique for valid mysql function/keyword in PHP? ...

fit mysql db in memory

I am using Redis database where we store the navigational information. These data must be persistent and should be fetched faster. I don't have more than 200 MB data in this data set. I face problem when writing admin modules for redis db and I really missing the sql schema and power of django style admin modules. Now I am thinking of ...

Help on a probably nested sql-query

Hello, I'm dealing with sql and my sql is not as good as my ruby, so I hope you can help me out. I have da table that looks like this: messages: id INTEGER PRIMARY KEY AUTO_INCREMENT to VARCHAR(255) text text shown DATETIME For now my script generates this part depending on the number of online players. "to = 'STEAM_0:0:xxx' OR to =...

How to insert a million records into a mysql database?

I have a two tables. TABLE 1 has id(PRIMARY)|RANK|WEBSITE |ADDRESS This is filled with a million websites. TABLE 2 has id(PRIMARY)|tag1|tag2|tag3 ......|tag30 I am generating the tags by scraping for the meta tags and other attributes. I have no problems populating the database for the first few thousand websites. After that, I am n...

Rails 3 and mysql master-slave replications

Hi! Want to set up mysql master-slave replications in rails app. Are there plugins/db adapters available for Rails 3? Does the Masochism plugin work properly with rails 3? ...

Mysql LIMIT statement in .NET TableAdapter query

Hi, I am adding the following query to a .NET dataset TableAdapter. select * from users ORDER BY RAND() LIMIT 0,10 But the LIMIT word is not recognized as a part of the query and I am unable to proceed further. Is there any workaround for this issue? ...