Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Articles Tagged ‘mysql’

Work with databases and the query builder in Laravel

Monday, November 30th, 2015 by Servage
database-queryWorking with database driven applications in Laravel is super straightforward. This functionality has been included as a core feature of the framework as database handling is almost done in every project. Using your Servage hosting account you can connect to one or multiple MySQL databases from Laravel and create, edit and delete data as you please. This article will outline some of the standard functionality for this. Configuration You first need to configure your Laravel installation for your environment. Note that you can use local configurations to make the database settings different depending on for example local development environment and production web hosting account. Below you find an example configuration. 'mysql' => [ ...

Increase database performance for your website

Saturday, March 21st, 2015 by Servage
databaseThe database performance is a common bottleneck for websites. This is rarely due to the actual database server, but most often caused by misuse of the database connection by making overly complicated requests, forgetting to optimize indexes or field types, forgetting caching and other reasons. Fortunately it is quite simple to implement a wide range of improvements which really can make an overall difference for the user-perceived performance of your site. Let us say you have a site which on average uses 2 seconds to render in the browser. Analyzing the different parts of that load time, you could have an allocation similar to the following: Request to server: 200ms Webserver script execution: 1.000ms ...

Building a good data model with Workbench

Friday, December 26th, 2014 by Servage
data-modelWhenever you start considering a new project you will quickly find yourself wondering about the data model. At least if you're the developer. Considering it early on helps building a good solution, and having a fine understanding of the caveats in data modeling is a great advantage. Why is the data model important The data model is important because it greatly impacts the future performance of your site or web app. During a user request to a normal dynamic website with PHP in the back end, it is not uncommon to execute a range of database queries. Poorly optimized sites may execute hundreds of database queries for every page load. Providing users with a ...

Understand the basics of SQL database programming

Sunday, October 19th, 2014 by Servage
SQL lets you access and manipulate databases with ease and quickness. Therefore, understanding the basics of SQL database programming may make differences for you as a web developer, as you have to frequently encounter with various databases and SQL. Understanding SQL Database Web programmers understand that SQL (Structured Query Language) is vital to access and manipulate databases - since databases are an inevitable part of our modern web. Moreover, our personalization approaches tend to lead to more interactions with databases in highly complex manners. Therefore, learning the language that can drives our database programming is a must - and this post is a part of giving you a basic understanding of it. Here are some examples ...

Introduction to MySQL – Course 3/3

Sunday, August 17th, 2014 by Servage
mysqlinstallwinxp026Enter your password when prompted. You can then try the following command, which should result in something like the screen grab. SHOW databases; There may be other databases already created, and the test database may not be there. Bear in mind also that system administrators have ultimate control over everything and that you can encounter some unexpected setups. For example, you may find that you are required to preface all database names that you create with a unique identifying string to ensure that you do not conflict with databases created by other users. If you have any problems, have a word with your system administrator, who should be able to sort them out. Let ...

Introduction to MySQL – Course 2/3

Thursday, August 14th, 2014 by Servage
qqSo, to enter MySQL’s command-line interface, select Start→Run and enter CMD into the Run box, then press Return. This will call up a Windows Command prompt. From there, enter one of the following (making any appropriate changes as just discussed): "C:\Program Files\Zend\MySQL51\bin" -u root "C:\Program Files (x86)\Zend\MySQL51\bin" -u root Note the quotation marks surrounding the path and filename. These are present because the name contains spaces, which the Command prompt doesn’t correctly interpret; the quotation marks group the parts of the filename into a single string for the Command program to understand. This command tells MySQL to log you in as the user root, without a password. You will now be logged in to MySQL and ...

Introduction to MySQL – Step 1/3

Tuesday, August 12th, 2014 by Servage
mysql-databases With well over ten million installations, MySQL is probably the most popular database management system for web servers. Developed in the mid-1990s, it’s now a mature technology that powers many of today’s most-visited Internet destinations. One reason for its success must be the fact that, like PHP, it’s free to use. But it’s also extremely powerful and exceptionally fast—it can run on even the most basic of hardware, and it hardly puts a dent in system resources. MySQL is also highly scalable, which means that it can grow with your website. In fact, in a comparison of several databases by eWEEK, MySQL and Oracle tied for both best performance and greatest scalability. MySQL Basics A ...

MYSQL commands – Part 7

Friday, July 18th, 2014 by Servage
table_in_useRemoving a column You may also decide, upon reflection, that the page count column pages isn’t actually all that useful for this particular database, so here’s how to remove that column using the DROP keyword: ALTER TABLE classics DROP pages; Remember that DROP is irreversible. You should always use it with caution, because you could delete entire tables (and even databases) with it if you are not careful! Deleting a table Deleting a table is very easy indeed. But, because I don’t want you to have to re-enter all the data for the classics table, we won’t delete that one. Instead, let’s quickly create a new table, verify its existence, and then delete it by typing ...

MySQL Commands – Part 6

Wednesday, July 16th, 2014 by Servage
figure2Continued from part 5... The second line of each INSERT command contains the keyword VALUES followed by four strings within parentheses, separated by commas. This supplies MySQL with the four values to be inserted into the four columns previously specified. (As always, my choice of where to break the lines was arbitrary.) Each item of data will be inserted into the corresponding column, in a one-to-one correspondence. If you accidentally listed the columns in a different order from the data, the data would go into the wrong columns. The number of columns must match the number of data items. Renaming a table Renaming a table, like any other change to the structure or meta-information of ...

MySQL Commands – Part 5

Monday, July 14th, 2014 by Servage
qqAUTO_INCREMENT data type As its name implies, a column given this data type will set the value of its contents to that of the column entry in the previously inserted row, plus 1. This is your introduction to the ALTER command, which is very similar to CREATE. ALTER operates on an existing table, and can add, change, or delete columns. Our example adds a column named id with the following characteristics: INT UNSIGNED Makes the column take an integer large enough for you to store more than four billion records in the table. NOT NULL Ensures that every column has a value. Many programmers use NULL in a field to indicate that the field doesn’t have a value, but ...