You can use FIND_IN_SET to do that: SELECT * FROM tablename WHERE id IN (1,10,8,5) ORDER BY FIND_IN_SET(id, ‘1,10,8,5’)
Category Archives: MySQL
Php, MySql, .htaccess: friendly urls
Php, MySql, .htaccess: friendly urls There are a lot of tutorials that show how to change an address like: www.mysite.com/products.php?product_id=1234 into others like: www.mysite.com/products/1234 www.mysite.com/products/1234.html In this article I’d like to go one step forward and to create something like: www.mysite.com/easy-to-remember-product-name www.mysite.com/easy-to-remember-product-name.html
mysql console backup restore
Question: How to backup the whole database? Answer: Just omit the “table_name” argument. For example, mysqldump -u root -pwordpress > D:\wordpress.sql Question: How to backup all the databases in MySQL? USE –force to continue on errors Answer: Use “–all-databases”. For example, mysqldump -u root -p –all-databases > D:\db.sql linux mysqldump -u admin -p –all-databases > db.sql Restoring Now let’s …
mysql: “not cleanly closed and upgrade needing tables” problem
I have used mysql server on my laptop with gutsy on xfs file system. I have tested on hardy version and have same output as following Quote: sudo /etc/init.d/mysql start * Starting MySQL database server mysqld [ OK ] * Checking for corrupt, not cleanly closed and upgrade needing tables. I google and couldn’t find …
Continue reading “mysql: “not cleanly closed and upgrade needing tables” problem”
How Do I Restart MySQL Server?
Each distribution comes with a shell script (read as service) to restart / stop / start MySQL server. First login as root user and open shell prompt (command prompt). First login as root user. Now type the following command as per your Linux distro:
I get the error: “Could not connect to SQL database. Too many connections”.
Symptoms Sometimes I get the “Too many connections” error in Plesk CP or when open a site in my browser: Unable to connect to database: Too many connections