mysql – Internetblog.org.uk https://www.internetblog.org.uk Web hosting, Domain names, Dedicated servers Fri, 29 Jan 2016 11:05:52 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.5 https://www.internetblog.org.uk/files/2016/01/cropped-favico-32x32.png mysql – Internetblog.org.uk https://www.internetblog.org.uk 32 32 Server Maintenance Tips https://www.internetblog.org.uk/post/1580/server-maintenance-tips/ Wed, 28 Jul 2010 16:02:01 +0000 http://www.internetblog.org.uk/post/1580/server-maintenance-tips/ Over the course of the past year, we have covered many dedicated server maintenance issues, particularly for servers running Linux. In no particular order, here is a list of some of the more important tips you should remember when taking care of your server.

1. When possible, rely on the distribution updates and repositories. Only add third-party software when absolutely necessary.

2. Periodically run fsck to check the file system.

3. Monitor system and service logs.

4. Disable unused services.

5. Periodically optimize MySQL databases.

6. Monitor CPU and RAM usage.

7. Optimize RAM and swap usage.

8. On larger servers, run the database server on a separate machine, optimize the servers for scalability, and consider using a CDN (Content Delivery Network).

Photo Source: Flickr

]]>
How to Increase MySQL Memory Usage Above 4GB https://www.internetblog.org.uk/post/1527/how-to-increase-mysql-memory-usage-above-4gb/ Tue, 13 Jul 2010 19:11:35 +0000 http://www.internetblog.org.uk/post/1527/how-to-increase-mysql-memory-usage-above-4gb/ RAM memory modules
Question: My database server is timing out because MySQL seems to hang once it has used up 4GB of RAM, even though the server is equipped with 6GB. How can I make MySQL take advantage of the full 6GB available?

Answer: If your current server setup involves a 32-bit architecture or even just a 32-bit version of your operating system, the short answer is: you cannot. By design MySQL will not be able to use more than 4GB unless it is running on a 64-bit OS.

If you are running Linux, type ” uname -m ” from the command line to see whether or not you are using a 64-bit version. If you know for a fact that your server actually has 64-bit processors, you can reinstall Linux with a 64-bit kernel.

The other less-drastic measure you may be able to take is to install a PAE (Physical Address Extension) kernel, which will allow your server to access physical address space larger than 4 GB. Some distributions, such as CentOS offer PAE kernel packages that you can easily install.

Source: Webhostingtalk.com
Photo: Flickr

]]>
Troubleshooting Database Connections https://www.internetblog.org.uk/post/1521/troubleshooting-database-connections/ Mon, 12 Jul 2010 19:17:37 +0000 http://www.internetblog.org.uk/post/1521/troubleshooting-database-connections/ Drupal database connection error
When MySQL works correctly, it can be a thing of beauty, but when something goes wrong, it can drive you mad. Here are a few things you can do to troubleshoot connection problems:

1. Make sure your username and password are correct.
2. Double-check the hostname. Although “localhost” works on most servers, it may not on yours.
3. Test the connection string (if you wrote the code yourself). You may have a simple typo.
4. If you have your own server, check the mysql server to see if it is running and running without errors.
5. Does the database you are trying to connect to actually exist? Sometimes automatic database creation fails, and you are left wondering why you cannot connect to it.
6. If you can connect locally but cannot connect remotely, check your firewall settings to see if port 3306 (or whichever port you use for mysql) is open.
7. Finally, be sure your mysql user has the necessary privileges to perform whatever task you are trying to accomplish.

Photo Source: Flickr

]]>
How to Delete Tables and Rows in MySQL https://www.internetblog.org.uk/post/1516/how-to-delete-tables-and-rows-in-mysql/ Fri, 09 Jul 2010 15:51:41 +0000 http://www.internetblog.org.uk/post/1516/how-to-delete-tables-and-rows-in-mysql/ mysqlAs I mentioned in a previous MySQL post, knowing how to quickly perform database tasks from the command line is a good idea if you are a Linux system administrator. Sometimes, it is the easier way to get things done, especially if you are helping another user and need root access to his or her database.

To delete a table, first login to MySQL:

mysql -u root -p

Enter your password and then switch to the database you want to edit by typing the following at the mysql> prompt:

mysql> use [db name];

Finally, drop the table:

mysql> drop table [table name];

Replace [table name] with the actual name of the table you want to remove.

To remove a row, type:

mysql> DELETE from [table name] where [field name] = 'whatever';

When you are finished, type “quit” to exit.

]]>
How to Search a MySQL Database https://www.internetblog.org.uk/post/1511/how-to-search-a-mysql-database/ Thu, 08 Jul 2010 17:45:21 +0000 http://www.internetblog.org.uk/post/1511/how-to-search-a-mysql-database/ MySQL command line interface
With web-based control panels and web software like phpMyAdmin, you have numerous options available for searching a MySQL Database. If the need should ever arise where those tools are not available, however, it is a good idea to know how to search a database from the command line.

To search MySQL from the command line, you need to log in to MySQL and perform a query.

Login as root:

mysql -u root -p
You should get a prompt like “mysql>”

To do a basic search, use the SELECT command. For example, to search for all records with the title of “Sales” that also have the number “44”, enter:

mysql> SELECT * FROM [table name] WHERE title = "Sales" AND number = '44';

You can perform similar queries on any tables in your database. For a more in-depth guide to queries, consult the MySQL documentation.

Photo Source: Wikimedia Commons

]]>
MySQL Optimization: Part 2 https://www.internetblog.org.uk/post/1492/mysql-optimization-part-2/ Fri, 02 Jul 2010 14:48:08 +0000 http://www.internetblog.org.uk/post/1492/mysql-optimization-part-2/ Mysql logo1. Query cache – On most servers, there are certain MySQL queries that you and/or your scripts will run more often than others. In fact, you may run the same query hundreds or even thousands of times in a single day. The query_cache setting will save the most used queries in memory for quick access

query_cache_limit=1M
query_cache_size=32M (32MB for every 1GB of RAM)
query_cache_type=1

2. Key buffer size – This refers to the size of buffers used for indexes. A larger buffer will result in faster SQL response time when a command is issued. The key_buffer_size should be at least 1/4 but no more than 1/2 of the RAM size of the server.

key_buffer=256M (128MB for every 1GB of RAM)

3. Table cache – Just like MySQL can cache queries, it can also cache tables. If you think about how often a database table would be accessed, especially when using content management systems and web applications, this only makes sense. You can adjust this according to your memory.

table_cache=1500

Next week, we will cover more MySQL optimization tips.

Source: linuxstuffs

]]>
MySQL Server Optimization https://www.internetblog.org.uk/post/1482/mysql-server-optimization/ Wed, 30 Jun 2010 16:08:42 +0000 http://www.internetblog.org.uk/post/1482/mysql-server-optimization/ Mysql logoIf you are running a dedicated server, optimization is very important to maximize speed, efficiency, and save time and energy. We have already looked at ways to optimize Apache web server, but many dynamic websites also use databases that hold the data for their dynamic web applications.

You can accomplish basic optimization of database tables from within your web-based control panel or in phpMyAdmin. You should do this routinely. But there are also ways you can optimize the server itself to serve databases faster and more securely. Over the remainder of this week, I will show you a few tips to optimize your MySQL server. Today, I will just point you to the right file.

To begin configuring your MySQL server, you will need to locate the configuration file. This will differ, depending on your operating system and even from one Linux distribution to another. Most commonly, it will be in a directory like /etc/mysql, and the file will be called my.cnf. You will need to edit it as root:

# nano /etc/mysql/my.cnf

Tomorrow, we will start to plow through this file for optimization tweaks.

]]>
Joomla Security Tips https://www.internetblog.org.uk/post/1385/joomla-security-tips/ Wed, 02 Jun 2010 15:45:37 +0000 http://www.internetblog.org.uk/post/1385/joomla-security-tips/ Joomla configuration
Joomla is a powerful free and open source content management system. It has become very popular, and many web hosting provider offer instant installer scripts that can automatically install Joomla onto a customer’s website. In certain, situations, however, you may prefer to install Joomla yourself. When you do, there are certain security issues you should know.

1. Delete the “install” directory. Joomla tells you to do this, and if you forget, the results can horrific.

2. Chmod configuration.php to at least 644. No one should be able to access your configuration.php file. The only reason to even leave it as 644 and not 600 is that some web servers on shared hosts require PHP files to be readable by the web server, which is a different user than the site owner.

3. Backup early and often – Create backups of Joomla’s MySQL database. If anything ever does go wrong, you will have a backup.

4. Install mod_security – ModSecurity is an application firewall designed for web applications like Joomla. It will protect you where a network firewall cannot.

5. Secure your database – Setup Joomla to access the database with a user with limited privileges, and make sure the password is not easy to guess.

There are many more security issues you should consider. Over the coming days, I will highlight some of them. Hopefully, they will help you keep your Joomla installation stable and secure.

]]>
MySQL Enterprise Released https://www.internetblog.org.uk/post/1333/mysql-enterprise-released/ Wed, 19 May 2010 18:05:47 +0000 http://www.internetblog.org.uk/post/1333/mysql-enterprise-released/ Oracle logoMonday, the database giant, Oracle, announced the release of MySQL Enterprise. In addition to the standard, freely available database software, this new packaged version of MySQL will include comprehensive support and monitoring tools. The primary tool available with this release is MySQL Monitor 2.2, which monitors performance and security. Other important tools include the Query Analyzer and MySQL Connector Plugins.

“DBAs and developers need solutions that help them manage their MySQL servers efficiently and allow them to identify performance issues before they become expensive, time-consuming problems,” said Tomas Ulin, director, MySQL Development, Oracle.

MySQL is one of the most widely-used database servers on the Web, and most web hosting providers offer it. While the underlying code for the database software is free and open source, there is also a commercially licensed version. MySQL was owned by Sun Microsystems until Oracle recently bought Sun and all of its software products.

Source: MarketWatch

]]>
SQLite for Your Database Needs https://www.internetblog.org.uk/post/1284/sqlite-for-your-database-needs/ Thu, 06 May 2010 18:20:27 +0000 http://www.internetblog.org.uk/post/1283/sqlite-for-your-database-needs/ SQLite logoIn the web hosting world, certain database software is commonplace. Most system administrators, even the new ones, have heard of MySQL, MSSQL, and/or PostgreSQL. Using SQL databases typically requires a database server to be running on the system. MySQL, for example, runs as a service in Linux called mysqld, or something similar. An alternative to running these types of services is to use SQLite.

Because it does not run via a sever, SQLite does not require the configuration and maintenance of other database systems. As a result, it is considered light and easy to use. Rather than running on a server, the database code is linked directly with the software using it. The library itself is small and can be installed in smaller installations.

According to their website, SQLite is the most often deployed database engine used in many web applications. It is free and open source, without a license, released into the public domain. You can download the libraries at the SQLite website.

]]>