MySQL is a popular open source relational database management system with multiple versions, each with its own features and functions. In this article, we will introduce some common MySQL versions with corresponding code examples.
CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL );
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES;
CREATE TABLE users ( id INT, username VARCHAR(255), email VARCHAR(255), PRIMARY KEY (id) ) ENGINE = NDBCLUSTER;
import com.mysql.cj.jdbc.MysqlDataSource; import java.sql.Connection; import java.sql.Statement; public class EmbeddedMySQLExample { public static void main(String[] args) { MysqlDataSource dataSource = new MysqlDataSource(); dataSource.setURL("jdbc:mysql:embedded://localhost/mydatabase"); dataSource.setUser("root"); dataSource.setPassword("password"); try (Connection con = dataSource.getConnection(); Statement stmt = con.createStatement()) { stmt.executeUpdate("CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL)"); } catch (Exception e) { e.printStackTrace(); } } }
In general, MySQL has multiple versions suitable for different user needs. Whether it is individual developers, small and medium-sized enterprises or large enterprises, you can choose the version that suits you according to the actual situation to build a stable database. Reliable database system.
The above is the detailed content of What versions of MySQL are there?. For more information, please follow other related articles on the PHP Chinese website!