如何使用Python在Arch Linux上安装并使用MySQL数据库?

摘要:1. 概述 Relational database like MariaDB is one of the required components to setup a web server as well as other less com
目录1. 概述2. 安装 MySQL / MariaDB3. 运行 MySQL / MariaDB4. 配置 MySQL / MariaDB5. 使用 MySQL / MariaDB链接 1. 概述 Relational database like MariaDB is one of the required components to setup a web server as well as other less common uses such as when configuring a shared Kodi database. On Arch Linux MySQL has been replaced by a functionally identical community fork called MariaDB. The installation is also practically identical and as simple as can be expected. 2. 安装 MySQL / MariaDB Install with pacman. sudo pacman -S mariadb Initialize data directories. > sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql Installing MariaDB/MySQL system tables in '/var/lib/mysql' ... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system Two all-privilege accounts were created. One is root@localhost, it has no password, but you need to be system 'root' user to connect. Use, for example, sudo mysql The second is mysql@localhost, it has no password either, but you need to be the system 'mysql' user to connect. After connecting you can set the password, if you would need to be able to connect as any of these users with a password and without sudo See the MariaDB Knowledgebase at https://mariadb.com/kb or the MySQL manual for more instructions. You can start the MariaDB daemon with: cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql' You can test the MariaDB daemon with mysql-test-run.pl cd '/usr/mysql-test' ; perl mysql-test-run.pl Please report any problems at https://mariadb.org/jira The latest information about MariaDB is available at https://mariadb.org/. You can find additional information about the MySQL part at: https://dev.mysql.com Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/ By default MySQL will run as the user running the command unless a user is explicitly specified with --user option. Path to the installation directory can be spec
阅读全文