mac 上使用 zip 版的mysql

1. 下载:
2. 解压,然后复制到需要的目录下
3. 修改 /usr/local/mysql的所有者为mysql: chown -R mysql:mysql mysql (这一步我是没做,爱做不做。)
4. 安装mysql ? : sudo mysql/scripts/mysql_install_db 
mjorcendeMacBook-Air:mysql-5.6.-osx10.-x86_64 mjorcen$ sudo scripts/mysql_install_db
Password:
Installing MySQL system tables...-- :: [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
-- :: [Note] InnoDB: Using atomics to ref count buffer pool pages
-- :: [Note] InnoDB: The InnoDB memory heap is disabled
-- :: [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
-- :: [Note] InnoDB: Memory barrier is not used
-- :: [Note] InnoDB: Compressed tables use zlib 1.2.
-- :: [Note] InnoDB: Using CPU crc32 instructions
-- :: [Note] InnoDB: Initializing buffer pool, size = 128.0M
-- :: [Note] InnoDB: Completed initialization of buffer pool
-- :: [Note] InnoDB: Highest supported file format is Barracuda.
-- :: [Note] InnoDB: The log sequence numbers and in ibdata files do not match the log sequence number in the ib_logfiles!
-- :: [Note] InnoDB: Database was not shutdown normally!
-- :: [Note] InnoDB: Starting crash recovery.
-- :: [Note] InnoDB: Reading tablespace information from the .ibd files...
-- :: [Note] InnoDB: Restoring possible half-written data pages
-- :: [Note] InnoDB: from the doublewrite buffer...
-- :: [Note] InnoDB: rollback segment(s) are active.
-- :: [Note] InnoDB: Waiting for purge to start
-- :: [Note] InnoDB: 5.6. started; log sequence number
-- :: [Note] Binlog end
-- :: [Note] InnoDB: FTS optimize thread exiting.
-- :: [Note] InnoDB: Starting shutdown...
-- :: [Note] InnoDB: Shutdown completed; log sequence number
OK Filling help tables...-- :: [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
-- :: [Note] InnoDB: Using atomics to ref count buffer pool pages
-- :: [Note] InnoDB: The InnoDB memory heap is disabled
-- :: [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
-- :: [Note] InnoDB: Memory barrier is not used
-- :: [Note] InnoDB: Compressed tables use zlib 1.2.
-- :: [Note] InnoDB: Using CPU crc32 instructions
-- :: [Note] InnoDB: Initializing buffer pool, size = 128.0M
-- :: [Note] InnoDB: Completed initialization of buffer pool
-- :: [Note] InnoDB: Highest supported file format is Barracuda.
-- :: [Note] InnoDB: rollback segment(s) are active.
-- :: [Note] InnoDB: Waiting for purge to start
-- :: [Note] InnoDB: 5.6. started; log sequence number
-- :: [Note] Binlog end
-- :: [Note] InnoDB: FTS optimize thread exiting.
-- :: [Note] InnoDB: Starting shutdown...
-- :: [Note] InnoDB: Shutdown completed; log sequence number
OK To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands: ./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h mjorcendeMacBook-Air.local password 'new-password' Alternatively you can run: ./bin/mysql_secure_installation which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd . ; ./bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com WARNING: Found existing config file ./my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as ./my-new.cnf,
please compare it with your file and take the changes you need. mjorcendeMacBook-Air:mysql-5.6.-osx10.-x86_64 mjorcen$

看上面的内容。 很明显,我成功了。

5. 至此,可以运行mysql服务器端了: sudo  mysql/bin/mysqld_safe &   (&在Unix系统里并不会在后台运行,尤其是使用像tomcat时非常有用,可以看得到输出的信息)
mysqld_multi  mysqld_safe
mjorcendeMacBook-Air:mysql-5.6.-osx10.-x86_64 mjorcen$ bin/mysqld_safe &
[]
mjorcendeMacBook-Air:mysql-5.6.-osx10.-x86_64 mjorcen$ :: mysqld_safe Logging to '/Users/mjorcen/Workspaces/mysql-5.6.22-osx10.9-x86_64/data/mjorcendeMacBook-Air.local.err'.
:: mysqld_safe Starting mysqld daemon with databases from /Users/mjorcen/Workspaces/mysql-5.6.-osx10.-x86_64/data
 
6. 运行mysql客户端:  mysql/bin/mysql -u root -p
mjorcendeMacBook-Air:mysql-5.6.-osx10.-x86_64 mjorcen$ mysql
-bash: mysql: command not found
mjorcendeMacBook-Air:mysql-5.6.-osx10.-x86_64 mjorcen$ bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6. MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
| test_one |
+--------------------+
rows in set (0.01 sec) mysql>
上一篇:【分布式搜索引擎】Elasticsearch中的基本概念


下一篇:Mysql命令大全&&指定端口登录