https://wiki.archlinux.org/api.php?action=feedcontributions&user=Joshkim&feedformat=atomArchWiki - User contributions [en]2024-03-29T15:01:54ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=MariaDB&diff=236326MariaDB2012-11-22T00:13:30Z<p>Joshkim: /* Installation */</p>
<hr />
<div>[[Category:Daemons and system services]]<br />
[[Category:Database management systems]]<br />
[[cs:MySQL]]<br />
[[de:MySQL]]<br />
[[es:MySQL]]<br />
[[fr:MySQL]]<br />
[[it:MySQL]]<br />
[[sr:MySQL]]<br />
[[tr:MySQL]]<br />
[[zh-CN:MySQL]]<br />
MySQL is a widely spread, multi-threaded, multi-user SQL database. For more information about features, see the [http://www.mysql.com/ official homepage].<br />
== Installation ==<br />
[[pacman|Install]] the {{Pkg|mysql}} package from the [[Official Repositories|official repositories]].<br />
<br />
After installing MySQL, start the daemon and run the setup script:<br />
# systemctl start mysqld<br />
# mysql_secure_installation<br />
<br />
Then restart MySQL:<br />
# systemctl restart mysqld<br />
<br />
To start MySQL automatically at boot:<br />
# systemctl enable mysqld<br />
<br />
----<br />
<br />
The above seems to be outdated. Instead of using sysvinit or systemd, use initscripts:<br />
# sudo pacman -S mysql<br />
# sudo /etc/rc.d/mysqld start<br />
# sudo mysql_secure_installation<br />
<br />
== Configuration ==<br />
Once you have started the MySQL server, you probably want to add a root account in order to maintain your MySQL users and databases. This can be done manually or automatically, as mentioned by the output of the above script. Either run the commands to set a password for the root account, or run the secure installation script.<br />
<br />
You now should be able to do further configuration using your favorite interface. For example you can use MySQL's command line tool to log in as root into your MySQL server:<br />
$ mysql -p -u root<br />
<br />
=== Enable remote access ===<br />
The MySQL server is not accessable from the network by default. To enable listing on TCP port 3306 to allow remote connections, comment out the following line in {{ic|/etc/mysql/my.cnf}}:<br />
skip-networking<br />
<br />
=== Enable auto-completion ===<br />
The MySQL client completion feature is disabled by default. To enable it system-wide edit {{ic|/etc/mysql/my.cnf}}, and replace {{ic|no-auto-rehash}} by {{ic|auto-rehash}}. Completion will be enabled next time you run the MySQL client. Please note that enabling this feature can make the client initialization longer.<br />
<br />
== Upgrading ==<br />
You might consider running this command after you have upgraded MySQL and started it:<br />
# mysql_upgrade -u root -p<br />
<br />
== Troubleshooting ==<br />
=== MySQL daemon cannot start ===<br />
If you see something like this:<br />
:: Starting MySQL [FAIL]<br />
and there is no entry in the log files, you might want to check the permissions of files in the directories {{ic|/var/lib/mysql}} and {{ic|/var/lib/mysql/mysql}}. If the owner of files in these directories is not {{ic|mysql:mysql}}, you should do the following:<br />
# chown mysql:mysql /var/lib/mysql -R<br />
If you run into permission problems despite having followed the above, ensure that your {{ic|my.cnf}} is copied to {{ic|/etc/}}:<br />
# cp /etc/mysql/my.cnf /etc/my.cnf<br />
Now try and start the daemon.<br />
<br />
If you get these messages in your {{ic|/var/lib/mysql/hostname.err}}<br />
[ERROR] Can't start server : Bind on unix socket: Permission denied<br />
[ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?<br />
[ERROR] Aborting<br />
The permissions of {{ic|/var/run/mysqld}} could be the culprit.<br />
# chown mysql:mysql /var/run/mysqld -R<br />
<br />
If you run mysqld and the following error appears:<br />
Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist<br />
Run the following command from the /usr directory to install the default tables:<br />
# cd /usr<br />
# mysql_install_db --user=mysql --ldata=/var/lib/mysql/<br />
<br />
=== Unable to run mysql_upgrade because MySQL cannot start ===<br />
Try run MySQL in safemode:<br />
# mysqld_safe --datadir=/var/lib/mysql/<br />
And then run:<br />
# mysql_upgrade -u root -p<br />
<br />
=== Reset the root password ===<br />
Stop the mysqld daemon<br />
# systemctl stop mysqld<br />
# mysqld_safe --skip-grant-tables &<br />
Connect to the mysql server<br />
# mysql -u root mysql<br />
Change root password:<br />
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';<br />
mysql> FLUSH PRIVILEGES;<br />
mysql> exit<br />
And restart the daemon:<br />
# systemctl restart mysqld<br />
<br />
== More Resources ==<br />
* [[LAMP]] - Arch wiki article covering the setup of a LAMP server (Linux Apache MySQL PHP)<br />
* http://www.mysql.com/<br />
* Front-ends: {{AUR|mysql-gui-tools}} {{AUR|mysql-workbench}}</div>Joshkimhttps://wiki.archlinux.org/index.php?title=MariaDB&diff=236325MariaDB2012-11-22T00:13:01Z<p>Joshkim: /* Installation */</p>
<hr />
<div>[[Category:Daemons and system services]]<br />
[[Category:Database management systems]]<br />
[[cs:MySQL]]<br />
[[de:MySQL]]<br />
[[es:MySQL]]<br />
[[fr:MySQL]]<br />
[[it:MySQL]]<br />
[[sr:MySQL]]<br />
[[tr:MySQL]]<br />
[[zh-CN:MySQL]]<br />
MySQL is a widely spread, multi-threaded, multi-user SQL database. For more information about features, see the [http://www.mysql.com/ official homepage].<br />
== Installation ==<br />
[[pacman|Install]] the {{Pkg|mysql}} package from the [[Official Repositories|official repositories]].<br />
<br />
After installing MySQL, start the daemon and run the setup script:<br />
# systemctl start mysqld<br />
# mysql_secure_installation<br />
<br />
Then restart MySQL:<br />
# systemctl restart mysqld<br />
<br />
To start MySQL automatically at boot:<br />
# systemctl enable mysqld<br />
<br />
<br />
The above seems to be outdated. Instead of using sysvinit or systemd, use initscripts:<br />
# sudo pacman -S mysql<br />
# sudo /etc/rc.d/mysqld start<br />
# sudo mysql_secure_installation<br />
<br />
== Configuration ==<br />
Once you have started the MySQL server, you probably want to add a root account in order to maintain your MySQL users and databases. This can be done manually or automatically, as mentioned by the output of the above script. Either run the commands to set a password for the root account, or run the secure installation script.<br />
<br />
You now should be able to do further configuration using your favorite interface. For example you can use MySQL's command line tool to log in as root into your MySQL server:<br />
$ mysql -p -u root<br />
<br />
=== Enable remote access ===<br />
The MySQL server is not accessable from the network by default. To enable listing on TCP port 3306 to allow remote connections, comment out the following line in {{ic|/etc/mysql/my.cnf}}:<br />
skip-networking<br />
<br />
=== Enable auto-completion ===<br />
The MySQL client completion feature is disabled by default. To enable it system-wide edit {{ic|/etc/mysql/my.cnf}}, and replace {{ic|no-auto-rehash}} by {{ic|auto-rehash}}. Completion will be enabled next time you run the MySQL client. Please note that enabling this feature can make the client initialization longer.<br />
<br />
== Upgrading ==<br />
You might consider running this command after you have upgraded MySQL and started it:<br />
# mysql_upgrade -u root -p<br />
<br />
== Troubleshooting ==<br />
=== MySQL daemon cannot start ===<br />
If you see something like this:<br />
:: Starting MySQL [FAIL]<br />
and there is no entry in the log files, you might want to check the permissions of files in the directories {{ic|/var/lib/mysql}} and {{ic|/var/lib/mysql/mysql}}. If the owner of files in these directories is not {{ic|mysql:mysql}}, you should do the following:<br />
# chown mysql:mysql /var/lib/mysql -R<br />
If you run into permission problems despite having followed the above, ensure that your {{ic|my.cnf}} is copied to {{ic|/etc/}}:<br />
# cp /etc/mysql/my.cnf /etc/my.cnf<br />
Now try and start the daemon.<br />
<br />
If you get these messages in your {{ic|/var/lib/mysql/hostname.err}}<br />
[ERROR] Can't start server : Bind on unix socket: Permission denied<br />
[ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?<br />
[ERROR] Aborting<br />
The permissions of {{ic|/var/run/mysqld}} could be the culprit.<br />
# chown mysql:mysql /var/run/mysqld -R<br />
<br />
If you run mysqld and the following error appears:<br />
Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist<br />
Run the following command from the /usr directory to install the default tables:<br />
# cd /usr<br />
# mysql_install_db --user=mysql --ldata=/var/lib/mysql/<br />
<br />
=== Unable to run mysql_upgrade because MySQL cannot start ===<br />
Try run MySQL in safemode:<br />
# mysqld_safe --datadir=/var/lib/mysql/<br />
And then run:<br />
# mysql_upgrade -u root -p<br />
<br />
=== Reset the root password ===<br />
Stop the mysqld daemon<br />
# systemctl stop mysqld<br />
# mysqld_safe --skip-grant-tables &<br />
Connect to the mysql server<br />
# mysql -u root mysql<br />
Change root password:<br />
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';<br />
mysql> FLUSH PRIVILEGES;<br />
mysql> exit<br />
And restart the daemon:<br />
# systemctl restart mysqld<br />
<br />
== More Resources ==<br />
* [[LAMP]] - Arch wiki article covering the setup of a LAMP server (Linux Apache MySQL PHP)<br />
* http://www.mysql.com/<br />
* Front-ends: {{AUR|mysql-gui-tools}} {{AUR|mysql-workbench}}</div>Joshkim