Git Repositories

Commit Initial
[animeka-installation.git] / Animeka / Installation / Bases_de_données / MySql.txt
1 Content-Type: text/x-zim-wiki
2 Wiki-Format: zim 0.4
3 Creation-Date: 2013-06-11T20:03:22+02:00
4
5 ====== MySql ======
6 Created mardi 11 juin 2013
7
8 ===== Paquets : =====
9 mysql-server
10 mysql-utilities
11 musqltuner
12
13 ===== Configuration : =====
14 MySql sera installé avec plusieurs instances, ce qui permet un meilleur contrôle.
15 Une instance pour le site, une pour le forum, et une pour le reste (si besoin).
16 L'instance pour le "reste" sera l'instance principale, on ne modifiera pas son adresse de socket pour simplifier les installation.
17
18 Installer le démon [[./mysqld_multi]] à placer dans [[/etc/init.d]] et à rendre exécutable.
19 On va commencer par désinstaller le démon [[/etc/init.d/mysql.]] Pour ça on va faire propre et simplement le supprimer des différents runlevel :
20 '''
21 # service mysql stop
22 # update-rc.d mysql remove
23 '''
24 Puis on active ''mysqld_mutli'' pour les runlevels par défaut :
25 '''
26 # update-rc.d mysqld_mutli start 03 2 3 4 5 stop 01 0 1 6
27 '''
28
29 Ensuite on copie [[/var/lib/mysql]] and [[/var/lib/mysql_site]] et [[/var/lib/mysql_forum]] :
30 '''
31 # for ext in site forum; do cp -a /var/lib/mysql /var/lib/mysql_$ext; done
32 '''
33
34 Il reste à configurer [[/etc/mysql/my_multi.cnf]] :
35 '''
36 [mysqld_mutli]
37 mysqld                  = /usr/bin/mysqld_safe
38 mysqladmin      = /usr/bin/mysqladmin
39 user                            = root
40 password                = 'mot de passe'
41 log                                     = /var/log/mysqld_multi.log
42 [client]
43 port                            = 3306
44 socket                  = /var/run/mysqld/mysqld.sock
45 [mysqld_safe]
46 socket                  = /var/run/mysqld/mysqld.sock
47 nice                            = 0
48 [mysqld1]
49 datadir                 = /var/lib/mysql
50 socket                  = /var/run/mysqld/mysqld.sock
51 port                            = 3306
52 pid-file                = /var/run/mysqld/mysqld.pid
53 log-error               = /var/log/mysqld.log
54 user                            = mysql
55 basedir                 = /usr
56 tmpdir                  = /tmp
57 lc-messages-dir = /usr/share/mysql
58 skip-external-locking
59 bind-address            = 127.0.0.1
60 key_buffer              = 16M
61 max_allowed_packet      = 16M
62 thread_stack            = 192K
63 thread_cache_size       = 8
64 myisam-recover         = BACKUP
65 query_cache_limit       = 1M
66 query_cache_size        = 16M
67 expire_logs_days        = 10
68 max_binlog_size         = 100M
69 [mysqld2]
70 datadir                 = /var/lib/mysql_site
71 socket                  = /var/run/mysqld/mysqld_site.sock
72 port                            = 3307
73 pid-file                = /var/run/mysqld/mysqld_site.pid
74 log-error               = /var/log/mysqld_site.log
75 user                            = mysql
76 basedir                 = /usr
77 tmpdir                  = /tmp
78 lc-messages-dir = /usr/share/mysql
79 skip-external-locking
80 bind-address            = 127.0.0.1
81 key_buffer              = 16M
82 max_allowed_packet      = 16M
83 thread_stack            = 192K
84 thread_cache_size       = 8
85 myisam-recover         = BACKUP
86 query_cache_limit       = 1M
87 query_cache_size        = 16M
88 expire_logs_days        = 10
89 max_binlog_size         = 100M
90 [mysqld3]
91 datadir                 = /var/lib/mysql_forum
92 socket                  = /var/run/mysqld/mysqld_forum.sock
93 port                            = 3308
94 pid-file                = /var/run/mysqld/mysqld_forum.pid
95 log-error               = /var/log/mysqld_forum.log
96 user                            = mysql
97 basedir                 = /usr
98 tmpdir                  = /tmp
99 lc-messages-dir = /usr/share/mysql
100 skip-external-locking
101 bind-address            = 127.0.0.1
102 key_buffer              = 16M
103 max_allowed_packet      = 16M
104 thread_stack            = 192K
105 thread_cache_size       = 8
106 myisam-recover         = BACKUP
107 query_cache_limit       = 1M
108 query_cache_size        = 16M
109 expire_logs_days        = 10
110 max_binlog_size         = 100M
111 [mysqldump]
112 quick
113 quote-names
114 max_allowed_packet      = 16M
115 [mysql]
116 [isamchk]
117 key_buffer              = 16M
118 !includedir /etc/mysql/conf.d/
119 '''
120
121 Et enfin, démarrer les instances :
122 '''
123 # service mysqld_multi start
124 '''