Download and use this front end tool to connect to MySQL database if you want to use as desktop application. No need to install PHP or webserver to connect to MySQL database. If you are not using PHP then MySQL workbench is the best choice. As a tool of Oracle Corporation you can easily connect and use it. You can store your set of queries as sql files and reuse it.
If you have PHP support with a web server running, this is one more good choice for you to manage MySQL database. You can use it in your localhost or can deploy it in your website. Most likely your web host is already providing you PhpMyAdmin support to manage your database. PhpMyAdmin is available in many languages (not programming language) you can select language of your choice.
You can run PhpMyAdmin in your local host and connect to google cloud to manage your MySQL database after doing proper settings like IP configuration etc.
We can connect our PHP script to MySQL by using mysqli support. The old one was mysql and it is not recommended now as it is replaced by mysqli or known as mysql improved.
SELECT * FROM table_name
This query remain same irrespective of platform we use to retrieve the records. The respective driver or library of the platform will have its own function to execute the above query. Here are some sample codes using the common query in different languages to get the same records from the MySQL table.
<?Php
require "config.php";// Database connection file.
$query="select * from student";
if ($result_set = $connection->query($query)) {
while($row = $result_set->fetch_array(MYSQLI_ASSOC)){
echo $row['id'],$row['name'],$row['class'],$row['mark']."<br>";
}
$result_set->close();
}
?>
import mysql.connector
my_connect = mysql.connector.connect(
host="localhost",
user="userid",
passwd="password",
database="database_name"
)
####### end of connection ####
my_cursor = my_connect.cursor()
my_cursor.execute("SELECT * FROM student")
my_result = my_cursor.fetchone() # we get a tuple
#print each cell ( column ) in a line
print(my_result)
String url = "jdbc:mysql://localhost:3306/my_tutorial";
String uname = "root";
String pass = ""; // your password
String query = " SELECT * FROM STUDENT ";
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(url,uname,pass);
Statement st= conn.createStatement();
ResultSet rs= st.executeQuery(query);
rs.next();
System.out.println(rs.getString("name"));
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.