MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pfs_defaults.cc
Go to the documentation of this file.
1 /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software Foundation,
14  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15 
21 #include "pfs.h"
22 #include "pfs_defaults.h"
23 #include "pfs_instr.h"
24 #include "pfs_setup_actor.h"
25 #include "pfs_setup_object.h"
26 
27 static PSI_thread_key key;
28 static PSI_thread_info info= { &key, "setup", PSI_FLAG_GLOBAL };
29 
31 {
32  PSI *psi= (PSI*) boot->get_interface(PSI_CURRENT_VERSION);
33  if (psi == NULL)
34  return;
35 
36  psi->register_thread("performance_schema", &info, 1);
37  PSI_thread *psi_thread= psi->new_thread(key, NULL, 0);
38  if (psi_thread == NULL)
39  return;
40 
41  /* LF_HASH needs a thread, for PINS */
42  psi->set_thread(psi_thread);
43 
44  String percent("%", 1, &my_charset_utf8_bin);
45  /* Enable all users on all hosts by default */
46  insert_setup_actor(&percent, &percent, &percent);
47 
48  /* Disable system tables by default */
49  String mysql_db("mysql", 5, &my_charset_utf8_bin);
50  insert_setup_object(OBJECT_TYPE_TABLE, &mysql_db, &percent, false, false);
51 
52  /* Disable performance/information schema tables. */
53  String PS_db("performance_schema", 18, &my_charset_utf8_bin);
54  String IS_db("information_schema", 18, &my_charset_utf8_bin);
55  insert_setup_object(OBJECT_TYPE_TABLE, &PS_db, &percent, false, false);
56  insert_setup_object(OBJECT_TYPE_TABLE, &IS_db, &percent, false, false);
57 
58  /* Enable every other tables */
59  insert_setup_object(OBJECT_TYPE_TABLE, &percent, &percent, true, true);
60 
61  psi->delete_current_thread();
62 }
63