<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=MySQL</id>
	<title>MySQL - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=MySQL"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=MySQL&amp;action=history"/>
	<updated>2026-05-06T13:31:59Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=MySQL&amp;diff=4341&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=MySQL&amp;diff=4341&amp;oldid=prev"/>
		<updated>2024-10-18T06:43:03Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 06:43, 18 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=MySQL&amp;diff=4340&amp;oldid=prev</id>
		<title>1&gt;Leonstr: /* Command line */ FLUSH PRIVILEGES implicit when using GRANT https://stackoverflow.com/a/36464093/17436831</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=MySQL&amp;diff=4340&amp;oldid=prev"/>
		<updated>2023-07-13T19:04:37Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Command line: &lt;/span&gt; FLUSH PRIVILEGES implicit when using GRANT https://stackoverflow.com/a/36464093/17436831&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
MySQL is one of the supported databases that underpins a Moodle installation. &lt;br /&gt;
&lt;br /&gt;
== Installing MySQL ==&lt;br /&gt;
&lt;br /&gt;
* If you are running Linux your preference should be to install using your distribution&amp;#039;s package manager. This ensures you will get any available updates.  However, you can also use apt-get or yum depending on the distribution that you are running.&lt;br /&gt;
* There are installers available for most popular operating systems at http://www.mysql.com/downloads/mysql/.&lt;br /&gt;
* It is possible and reasonably straightforward to build mysql from source but it is not recommended (the pre-built binaries are supposedly better optimised).&lt;br /&gt;
* Make sure you set a password for the &amp;#039;root&amp;#039; user (see http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html).&lt;br /&gt;
* Consider installing and configuring my.cnf (the MySQL settings file) to suit your needs. The default configuration is usually very conservative in respect of memory usage versus performance. Increase the &amp;#039;max_allowed_packet&amp;#039; setting to at least 4 megabytes.&lt;br /&gt;
* If you are going to use Master/Slave replication, you must add binlog_format = &amp;#039;ROW&amp;#039; into your my.cnf within [mysqld]. Otherwise, Moodle will not be able to write to the database.&lt;br /&gt;
&lt;br /&gt;
=== Configure full UTF-8 support ===&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s recommended that full UTF-8 support is configured in MySQL. If this is not done some character sets – notably emojis – cannot be used. It is possible to do this after installing your site but is much easier and quicker before installation.&lt;br /&gt;
&lt;br /&gt;
Check if this is already configured by running the following statement, e.g. at the &amp;#039;&amp;#039;&amp;#039;mysql&amp;gt;&amp;#039;&amp;#039;&amp;#039; prompt or in phpMyAdmin:&lt;br /&gt;
&amp;lt;pre&amp;gt;SHOW GLOBAL VARIABLES WHERE variable_name IN (&amp;#039;innodb_file_format&amp;#039;, &amp;#039;innodb_large_prefix&amp;#039;, &amp;#039;innodb_file_per_table&amp;#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:phpMyAdmin1.png|alt=innodb_file_format=Barracuda;innodb_file_per_table=ON;innodb_large_prefix=ON]] or [[File:phpMyAdmin2.png|alt=innodb_file_format=(blank);innodb_file_per_table=ON;innodb_large_prefix=(blank)]] or [[File:phpMyAdmin3.png|alt=innodb_file_per_table=ON]]&lt;br /&gt;
&lt;br /&gt;
If the settings you see match any list above then no changes are needed and you can skip to [[#Creating_Moodle_database| Creating Moodle database]].&lt;br /&gt;
&lt;br /&gt;
If your settings do not match any list you will have to edit the MySQL configuration file. On Linux this may be &amp;#039;&amp;#039;&amp;#039;/etc/my.cnf&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;/etc/mysql/my.cnf&amp;#039;&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;&amp;#039;/etc/my.cnf.d/mariadb-server.cnf&amp;#039;&amp;#039;&amp;#039;; on Microsoft Windows it may be &amp;#039;&amp;#039;&amp;#039;my.ini&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
* Note: Back up the configuration file before changing it.&lt;br /&gt;
* Note: Back up all databases before making this change.&lt;br /&gt;
* Note: Other systems with databases on this server may be impacted by this change.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add the following settings to the configuration file, do not add &amp;#039;&amp;#039;&amp;#039;innodb_file_format = Barracuda&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;innodb_large_prefix = 1&amp;#039;&amp;#039;&amp;#039; if these were blank or missing when you ran &amp;#039;&amp;#039;&amp;#039;SHOW GLOBAL VARIABLES&amp;#039;&amp;#039;&amp;#039; above:&lt;br /&gt;
&amp;lt;pre&amp;gt;[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
innodb_file_format = Barracuda   # Remove line if not needed&lt;br /&gt;
innodb_file_per_table = 1&lt;br /&gt;
innodb_large_prefix = 1          # Remove line if not needed&lt;br /&gt;
&lt;br /&gt;
character-set-server = utf8mb4&lt;br /&gt;
collation-server = utf8mb4_unicode_ci&lt;br /&gt;
skip-character-set-client-handshake&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the MySQL server process to apply these settings (for example with MariaDB on Linux: &amp;#039;&amp;#039;&amp;#039;systemctl restart mariadb&amp;#039;&amp;#039;&amp;#039;).&lt;br /&gt;
&lt;br /&gt;
If you have any difficulty applying these settings, see [[MySQL_full_unicode_support]] for further information.&lt;br /&gt;
&lt;br /&gt;
If for some reason you cannot change to the settings described here you can continue to install Moodle but you must select &amp;#039;&amp;#039;&amp;#039;utf8&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;utf8_unicode_ci&amp;#039;&amp;#039;&amp;#039; for the default character set and collation respectively.&lt;br /&gt;
&lt;br /&gt;
== Creating Moodle database ==&lt;br /&gt;
&lt;br /&gt;
These are the steps to create an empty Moodle database. Substitute your own database name, user name and password as appropriate.&lt;br /&gt;
&lt;br /&gt;
The instructions assume that the web server and MySQL server are on the same machine. In this case the &amp;#039;dbhost&amp;#039; is &amp;#039;localhost&amp;#039;. If they are on different machines substitute the name of the web server for &amp;#039;localhost&amp;#039; in the following instructions and the &amp;#039;dbhost&amp;#039; setting will be the name of the database server. &lt;br /&gt;
Databases have a &amp;quot;Character set&amp;quot; and a &amp;quot;Collation&amp;quot;. For Moodle, we recommend the Character Set be set to &amp;#039;&amp;#039;&amp;#039;utf8mb4&amp;#039;&amp;#039;&amp;#039; and the Collation &amp;#039;&amp;#039;&amp;#039;utf8mb4_unicode_ci&amp;#039;&amp;#039;&amp;#039;. You may get the option to set these values when you create the database. If you are not given a choice, the default options are probably good. An install on an old server may have the wrong settings.&lt;br /&gt;
&lt;br /&gt;
=== Command line === &lt;br /&gt;
&lt;br /&gt;
* To create a database using the &amp;#039;mysql&amp;#039; command line client, first log into MySQL&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ mysql -u root -p&lt;br /&gt;
Enter password: &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Enter the password you previously set - or been given - for the MySQL &amp;#039;root&amp;#039; user). After some pre-amble this should take you to the &amp;#039;&amp;#039;mysql&amp;gt;&amp;#039;&amp;#039; prompt.&lt;br /&gt;
* Create a new database (called &amp;#039;moodle&amp;#039; - substitute your own name if required).&lt;br /&gt;
If you have successfully configured the recommended full UTF-8 support as described above run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you do not have the recommended full UTF-8 support run:&lt;br /&gt;
&amp;lt;pre&amp;gt;mysql&amp;gt; CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Add a user/password with the minimum needed permissions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; CREATE USER moodleuser@localhost IDENTIFIED BY &amp;#039;yourpassword&amp;#039;;&lt;br /&gt;
mysql&amp;gt; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@localhost;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...which creates a user called &amp;#039;moodleuser&amp;#039; with a password &amp;#039;yourpassword&amp;#039;. Make sure you invent a strong password and resist the temptation to &amp;#039;GRANT ALL&amp;#039;.&lt;br /&gt;
* Exit from mysql:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; quit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== phpMyAdmin ===&lt;br /&gt;
&lt;br /&gt;
[http://www.phpmyadmin.net/ phpMyAdmin] is a web based administration tool for MySQL. If this is available you can use it to create a new database. If you have successfully configured the recommended full UTF-8 support as described above select collation &amp;#039;&amp;#039;&amp;#039;utf8mb4_unicode_ci&amp;#039;&amp;#039;&amp;#039;. If you do not have the recommended full UTF-8 support select collation &amp;#039;&amp;#039;&amp;#039;utf8_unicode_ci&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
==Which database belongs to which Moodle==&lt;br /&gt;
If you have installed several Moodle installations on the same server, there will be several databases in your MySQL server. The names might be quite poor reflections of the content like  _mdl1 _mdl2 _mdl3 . So how do I see which database goes with which Moodle installation? You can go in with phpMyAdmin and in the various databases check for the table &amp;quot;mdl_course&amp;quot;. There you will easily see the name of that Moodle Installation. In table mdl_config you can see the Moodle version. The main URL for the site is not in the database except where there are absolute links.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB]]&lt;br /&gt;
* [[MySQL full unicode support]]&lt;br /&gt;
* [http://www.mysql.com/ The MySQL homepage]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/MySQL Wikipedia article about &amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;]&lt;br /&gt;
* [http://forums.mysql.com/read.php?24,92131,92131 List of articles on MySQL performance tuning]&lt;br /&gt;
&lt;br /&gt;
[[Category:SQL databases]]&lt;br /&gt;
&lt;br /&gt;
[[ja:MySQL]]&lt;br /&gt;
[[de:MySQL]]&lt;br /&gt;
[[es:MySQL]]&lt;/div&gt;</summary>
		<author><name>1&gt;Leonstr</name></author>
	</entry>
</feed>