mysql_camp - invoke the mysql client for a camp MySQL instanceVERSION
Invokes the standard mysql client shell, with appropriate connection parameters for working with your camp database.
The utility will attempt to determine your current camp from the current working directory, if possible, when no camp is specified in the options list.OPTIONS
The name of the database to which you want to connect with the mysql client. If not provided, this will resort to the default database (if one is registered) for the camp (see the mysql.yml file for your camp to determine this and optionally set it). If no database is specified, and no default database is set, then no database will be specified in the call to mysql, and the resulting behavior will depend on your account's my.cnf file.
The name of the user account with which the connection to mysql should be made. If not provided, this will resort to the default user (if registered) for the camp (see the mysql.yml file); if not specified there, it will depend on your account's my.cnf file.
No password is needed for this; the password is expected to be known to the mysql.yml file, and the utility will provide the password for you.
The number of the camp whose MySQL database you want to use. This is required in the event that you are at some random location within the filesystem, or if you want to connect to a camp database other than the camp the directory of which you're currently in. If unspecified, the utility will attempt to determine the current camp based on your current working directory.
If no camp can be determined, then an error will be thrown.
Rather than invoke the mysql client, print the command that would be used to invoke it. Be warned that this results in printing the password in the clear. However, given that the password is already in the mysql.yml file, and only the owner of the camp can invoke this script, that's not so big a deal.
This help information.
The camp system makes access to databases a bit tricky, since each camp's database (in this case, MySQL) listens on an alternate port or socket file, with each user account having custom, random passwords rather than consistent, known passwords. Therefore, the mysql_camp script is intended to simplify this, such that you may get to the mysql client for your database painlessly without needing to know the custom port/socket, etc.
Use the mysql_camp script whenever you would ordinarily use mysql directly, paying attention to the three simple options outlined above. Any additional arguments or options provided will be passed along to the underlying mysql call, but use these at your own risk; you may result in collisions with the options the utility automatically generates for you.
The socket, port, hostname, password, etc. are expected to reside in the relevant camp's mysql.yml file, which is a YAML file that is easily readable and understandable. The utility makes a best guess at connecting to the database based on the contents of that file. If the file doesn't exist, it will throw an error.AUTHOR
Ethan Rowe and other contributorsLICENSE AND COPYRIGHT
Copyright (C) 2006-2015 End Point Corporation, https://www.endpoint.com/
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see: http://www.gnu.org/licenses/
© 2006–2017 End Point Corporation