LoginSignup
4
1

More than 5 years have passed since last update.

macにmysqldiffを導入する

Last updated at Posted at 2016-09-07

前提

  • mac

参考

http://stackoverflow.com/questions/24267017/importerror-no-module-named-connector-conversion
http://qiita.com/shogogg/items/977cf2c7ab3acfba7af8

方法

$ git clone https://github.com/mysql/mysql-utilities.git
$ cd mysql-utilities
$ python setup.py build
$ python setup.py install

こんな感じにエラーが発生したら

error: could not delete '/Library/Python/2.7/site-packages/mysql/__init__.py': Permission denied

sudoで対応

$ sudo python setup.py install

これで参考先を見たらできるはずだったんだけど、
なんかエラッた

Traceback (most recent call last):
  File "/bin/mysqluc", line 23, in <module>
  from mysql.utilities.common.options import license_callback, UtilitiesParser
File "/Library/Python/2.7/site-packages/mysql/utilities/common/options.py", line 34, in     <module>
from mysql.connector.conversion import MySQLConverter
ImportError: No module named connector.conversion

stackoverflowさんによると以下をインスコするといけるらしい

いけたみたい↓

$ mysqldiff --help
MySQL Utilities mysqldiff version 1.6.4
License type: GPLv2
Usage: mysqldiff --server1=user:pass@host:port:socket --server2=user:pass@host:port:socket db1.object1:db2.object1 db3:db4

mysqldiff - compare object definitions among objects where the difference is
how db1.obj1 differs from db2.obj2

Options:
  --version             show program's version number and exit
  --help                display a help message and exit
  --license             display program's license and exit
  --ssl-ca=SSL_CA       path to a file that contains a list of trusted SSL
                        CAs.
  --ssl-cert=SSL_CERT   name of the SSL certificate file to use for
                        establishing a secure connection.
  --ssl-key=SSL_KEY     name of the SSL key file to use for establishing a
                        secure connection.
  --ssl=SSL             specifies if the server connection requires use of
                        SSL. If an encrypted connection cannot be established,
                        the connection attempt fails. By default 0 (SSL not
                        required).
  --server1=SERVER1     connection information for first server in the form:
                        <user>[:<password>]@<host>[:<port>][:<socket>] or
                        <login-path>[:<port>][:<socket>] or <config-
                        path>[<[group]>].
  --server2=SERVER2     connection information for second server in the form:
                        <user>[:<password>]@<host>[:<port>][:<socket>] or
                        <login-path>[:<port>][:<socket>] or <config-
                        path>[<[group]>].
  --character-set=CHARSET
                        sets the client character set. The default is
                        retrieved from the server variable
                        'character_set_client'.
  --width=WIDTH         display width
  --force               do not abort when a diff test fails
  -c, --compact         compact output from a diff.
  --skip-table-options  skip check of all table options (e.g., AUTO_INCREMENT,
                        ENGINE, CHARSET, etc.).
  -v, --verbose         control how much information is displayed. e.g., -v =
                        verbose, -vv = more verbose, -vvv = debug
  -q, --quiet           turn off all messages for quiet execution.
  -d DIFFTYPE, --difftype=DIFFTYPE
                        display differences in context format in one of the
                        following formats: [unified|context|differ|sql]
                        (default: unified).
  --changes-for=CHANGES_FOR
                        specify the server to show transformations to match
                        the other server. For example, to see the
                        transformation for transforming server1 to match
                        server2, use --changes-for=server1. Valid values are
                        'server1' or 'server2'. The default is 'server1'.
  --show-reverse        produce a transformation report containing the SQL
                        statements to transform the object definitions
                        specified in reverse. For example if --changes-for is
                        set to server1, also generate the transformation for
                        server2. Note: the reverse changes are annotated and
                        marked as comments.
4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1