Skip to main content

Posts

Showing posts with the label MySQL server

Independent Connection Information

For many programmers, the idea of storing connection information (such as username and password) directly in the script itself is a little unnerving and rightfully so. Even though, with the correct privileges assigned to the actual file housing the php script, there would be little concern for the scripts themselves from being seen. As a best practice, it is wise to create a separate PHP script file that would contain variables that would contain the connection information and could be used in the PHP script that is actually connecting to the MySQL server. A typical file containing this connection information would look something like the example below: <?php // MySQL Server Connection Information $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'training'; ?> In this example, the file would be saved as "connect_info.php" and stored in the same folder as our php script (most likely the htdocs folder of the apache server). Using t

Connecting to MySQL

PHP and MySQL are two different technologies that have found favor in the community of web developers based on their combined strength. This of course has given rise to both technologies finding great success in the marketplace that they may not have enjoyed otherwise. Those responsible for the two technologies have worked hard to provide the end users easy to use interfaces and technologies to ensure that the integration of the two are smooth and support the creation of next generation websites. User Privileges MySQL has a very strong authentication system that allows multiple security levels for each user that can access the server. MySQL's highly effective security system can cause headaches for those trying to break into the data, but likewise can cause headaches for those that are authorized to access the data. MySQL sees any requests from PHP in the same way that it sees requests from any other API (such as the mysql client or MySQL Query Browser) and will requir

Database Design Practices

In database discussions, it is common to hear the term normalization or database design come up. However, for the most parts these discussions revolve around splitting up the data that is stored between different  tables to improve performance and to eliminate duplication.  This is extremely important and should be  discussed in any discussion on tables but for the most part the discussions do not involve splitting up data  between databases.  This is either assumed or just not put into practice as often as it should be.  Either way,  it is important to consider when designing an application that will need to access data. Information Commonality Data could be defined as the actual values that are stored in the database itself and are static until they are changed by some process (either manually or automated). Data by itself is useless if not processed in such a way as to give it meaning.  Information, on the other hand, is data processed in such a way as to give it meani

The mysql Client

The mysql Client           This section discusses mysql, a general-purpose client program for issuing queries and retrieving their results. It can be used interactively or in batch mode to read queries from a file. Using mysql Interactively      The mysql client program enables the sending of queries to the MySQL server with any results being displayed in the same interface. It can be used interactively or it can read query input from a file in batch mode: • Interactive mode is useful for day-to-day usage, for quick one-time queries, and for testing how queries work. • Batch mode is useful for running queries that have been prewritten and stored in a file. It's especially valuable for issuing a complex series of queries that's difficult to enter manually, or queries that need to be run automatically by a job scheduler without user intervention. MySQL statements such as the version query, shown below as executed within the mysql client, can also be run from the s