Hosting & Domaining Forum

Hosting & Domaining development => Programming Discussion => Databases => Topic started by: Socialmarketing on Dec 13, 2022, 04:00 AM

Title: Which database should I choose to begin studying
Post by: Socialmarketing on Dec 13, 2022, 04:00 AM
What's the best database to start with as a beginner? I heard that MySQL is commonly used, but I'm having trouble finding a version for Win-64 on the download page. Can you recommend a good guide for beginners?

It turns out that you don't need to download the database separately. Instead, you need to uncomment the desired line in php.ini.

I've been trying to connect to the database using the following code:

try {
    $dbh = new PDO('mysql:dbname=db_name;host=localhost', 'login', 'password');
} catch (PDOException $e) {
    die($e->getMessage());
}

However, I keep getting an error message that says "SQLSTATE[HY000] [2002] The connection is not established because the destination computer rejected the connection request." I suspect that I need to start the database server first, but I'm not sure how to do that.

Do you think I need to register host=localhost:4000 instead of host=localhost? I tried that, but the page doesn't reload at all now.
Title: Re: Which database should I choose to start studying
Post by: blueangelhost on Dec 13, 2022, 04:49 AM
To begin with, it's important to understand the correct terminology such as "DBMS" and "database server." As a beginner, it's recommended to use the "native" extension - mysqli.

If you're using virtual hosting, the entire standard set of popular tools is already provided for you. However, if you're using a dedicated server (VDS), you'll need to install and configure it yourself.

Check out this link https://dev.mysql.com/downloads/installer/ for database installation and setup instructions. Additionally, this link https://dev.mysql.com/doc/refman/8.0/en/ provides dоcumentation on various concepts related to databases.
Title: Re: Which database should I choose to start studying
Post by: alvinwright on Feb 13, 2023, 11:35 AM
Nowadays, most advanced databases support a wide range of data storage types. One such example is MS SQL Server, which supports relational, columnar, and graph data storage options. Key-value storage is also widely used. Additionally, the support of XML and JSON allows for the possibility of it being attributed to dоcument-oriented databases.

It's worth noting that understanding the different types of data storage options can greatly benefit companies in terms of optimizing their data management systems. By selecting the right type of database for their specific needs, businesses can increase efficiency and reduce costs.
Title: Re: Which database should I choose to begin studying
Post by: comdali on May 08, 2024, 10:35 AM
MySQL is indeed a popular and well-supported choice, especially for web applications. As for downloading MySQL for Windows 64-bit, the process may not be as straightforward as simply finding a dedicated 64-bit version on the download page. Often, the same installation package can work for both 32-bit and 64-bit systems.

To address the specific error message "SQLSTATE[HY000] [2002] The connection is not established because the destination computer rejected the connection request," it's important to first ensure that the MySQL server is running and reachable. To start the MySQL server on your local machine, you would typically use a command line interface or a tool such as XAMPP or WampServer if you have them installed. These utilities provide a convenient way to start and stop the MySQL server, as well as the web server, directly from the system tray.

If you're using the command line to start the MySQL server, the command may look something like this:
mysql.server start

Alternatively, if you're using XAMPP or WampServer, there should be an interface or a control panel where you can start the MySQL server. Once the server is running, your PDO connection string should be able to establish a connection.

Regarding the use of `localhost:4000` instead of simply `localhost`, it's important to note that the default port for MySQL is 3306. Unless you have explicitly configured your MySQL server to listen on a different port, there's no need to specify the port in the connection string. Therefore, you should continue using `host=localhost` without specifying a port.

When troubleshooting database connectivity issues, it's important to consider potential firewall settings that may be blocking the connection. If you're running a firewall on your machine, you may need to configure it to allow connections to the MySQL server on the appropriate port.
Database setup and connectivity can be complex for beginners, but with patience and attention to detail, you can work through these challenges. Utilize official dоcumentation, community forums, and resources such as video tutorials to deepen your understanding. Each step you take in troubleshooting will contribute to your growth and expertise in working with databases.