github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/charms/mysql/README.md (about) 1 # Overview 2 3 [MySQL](http://www.mysql.com) is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the most popular database query language in the world. The main goals of MySQL are speed, robustness and ease of use. 4 5 This charm also can deploy [Percona Server](http://www.percona.com/software/percona-server) is fork of MySQL by Percona Inc. which focuses on maximizing performance, particularly for heavy workloads. It is a drop-in replacement for MySQL and features XtraDB, a drop-in replacement for the InnoDB storage engine. 6 7 # Usage 8 9 ## General Usage 10 11 To deploy a MySQL service: 12 13 juju deploy mysql 14 15 Once deployed, you can retrive the MySQL root user password by logging in to the machine via `juju ssh` and readin the `/var/lib/mysql/mysql.passwd` file. To log in as root MySQL User at the MySQL console you can issue the following: 16 17 juju ssh mysql/0 18 mysql -u root -p=`cat /var/lib/mysql/mysql.passwd` 19 20 # Scale Out Usage 21 22 ## Replication 23 24 MySQL supports the ability to replicate databases to slave instances. This 25 allows you, for example, to load balance read queries across multiple slaves or 26 use a slave to perform backups, all whilst not impeding the master's 27 performance. 28 29 To deploy a slave: 30 31 # deploy second service 32 juju deploy mysql mysql-slave 33 34 # add master to slave relation 35 juju add-relation mysql:master mysql-slave:slave 36 37 Any changes to the master are reflected on the slave. 38 39 Any queries that modify the database(s) should be applied to the master only. 40 The slave should be treated strictly as read only. 41 42 You can add further slaves with: 43 44 juju add-unit mysql-slave 45 46 ## Monitoring 47 48 This charm provides relations that support monitoring via either [Nagios](https://jujucharms.com/precise/nagios) or [Munin](https://jujucharms.com/precise/munin/). Refer to the appropriate charm for usage. 49 50 # Configuration 51 52 You can tweak various options to optimize your MySQL deployment: 53 54 * max-connections - Maximum connections allowed to server or '-1' for default. 55 56 * preferred-storage-engine - A comma separated list of storage engines to 57 optimize for. First in the list is marked as default storage engine. 'InnoDB' 58 or 'MyISAM' are acceptable values. 59 60 * tuning-level - Specify 'safest', 'fast' or 'unsafe' to choose required 61 transaction safety. This option determines the flush value for innodb commit 62 and binary logs. Specify 'safest' for full ACID compliance. 'fast' relaxes the 63 compliance for performance and 'unsafe' will remove most restrictions. 64 65 * dataset-size - Memory allocation for all caches (InnoDB buffer pool, MyISAM 66 key, query). Suffix value with 'K', 'M', 'G' or 'T' to indicate unit of 67 kilobyte, megabyte, gigabyte or terabyte respectively. Suffix value with '%' 68 to use percentage of machine's total memory. 69 70 * query-cache-type - Specify 'ON', 'DEMAND' or 'OFF' to turn query cache on, 71 selectively (dependent on queries) or off. 72 73 * query-cache-size - Size of query cache (no. of bytes) or '-1' to use 20% 74 of memory allocation. 75 76 Each of these can be applied by running: 77 78 juju set <service> <option>=<value> 79 80 e.g. 81 82 juju set mysql preferred-storage-engine=InnoDB 83 juju set mysql dataset-size=50% 84 juju set mysql query-cache-type=ON 85 juju set mysql query-cache-size=-1 86 87 Deploying Percona Server is an option in this charm, you can do so by editing the `flavor` option: 88 89 juju set mysql flavor=percona 90 91 WARNING: Migrating from MySQL to Percona Server in this fashion is currently a one-way migration, once you migrate you cannot migrate back via Juju. 92 93 # MySQL and Percona Server Contact Information 94 95 - [MySQL Homepage](http://www.mysql.com) 96 - [MySQL Bug Tracker](http://bugs.mysql.com/) 97 - [Percona Server Homepage](http://www.percona.com/software/percona-server) 98 - [Percona Server Bug Tracker](https://bugs.launchpad.net/percona-server/) 99 - [MySQL mailing lists](http://lists.mysql.com/)