Mac新手入门
2015-10-13 17:46
381 查看
这两天rmbp到手,开心
,但是无奈我不会用,装app出各种篓子,真是日了狗了。
-------------------------------------------------------------
安装Xcode(自带command line tools,一直听别人说要装要装,后来发现Xcode自带),evernote,DASH 都没出什么问题。
安装Intellij IDEA, 提示说要jdk,照着它做就行了,从苹果官网下载了jdk1.6.
安装flashlight。这货真是巨坑,知乎上说好用的不得了,下了才发现用不了了。卸载了菜单上还有它的logo,我一直以为没有卸掉,试了各种clean app都没有用。最后还是我灵机一动,重启了电脑,然后那个logo就消失了。。。。。
安装麦库记事。我的windows上一直用的是它,结果装了mac版才发现不能同步过来。只好卸了。
安装百度云。这货都没有mac版,只有一个同步盘什么的,装你妹妹。。。
安装alfred,最期待的kill process workflow竟然不能用,因为这货要交钱才能用workflow。好吧,我还是留着它,确实比spotlight好用。
terminal部分:
作为一个程序员,我当然要好好利用mac终端了对不对!
装了大家都推荐的homebrew。
这里再引一部分另两篇博文:http://blog.csdn.net/delphiwcdj/article/details/19679891
http://www.tuicool.com/articles/niyQNv
------------------------------------------------------------------------------------------------
Homebrew:在Lion之后兴起的包管理工具,工作方式与MacPorts类似,下载源代码然后本地Build。不同之处在于Homebrew采取与MacPorts截然相反的态度,对系统资源是最大程度的利用,因此可以说Homebrew是直接对现有系统生态环境进行修改,所有包也是直接安装到现有的生态环境中,这样做的好处是节约了系统资源,但缺点是每一次操作都是直接对系统进行修改,严重依赖和影响现有系统。Homebrew安装之前要求安装Xcode。
(3) 如何删除Homebrew?
If you installed to
and the stuff Homebrew installed leaving anything else in
Provided you haven’t put anything else in Homebrew’s prefix(
(4) Homebrew下载的package存放的路径在哪里?
gerryyang@mba:bin$brew --cache
/Library/Caches/Homebrew
gerryyang@mba:bin$ls /Library/Caches/Homebrew/
Formula/ wget-1.14.tar.gz
coreutils-8.22.tar.xz wget-1.15.tar.gz
openssl-1.0.1f.mavericks.bottle.tar.gz xz-5.0.5.mavericks.bottle.2.tar.gz
gerryyang@mba:bin$ls /Library/Caches/Homebrew/Formula/
coreutils.brewing openssl.brewing wget.brewing xz.brewing
gerryyang@mba:bin$
由于之前使用源码方式安装过wget,因此再用brew安装时会提示冲突的错误,因为/usr/locat/bin/wget已经存在。
实际上,Homebrew 将软件包分装到单独的目录(/usr/local/Cellar),然后 symlink 到 /usr/local 中。
------------------------------------------------------------------------------------------------------
mrgaodeMacBook-Pro:~ gao$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir /usr/local
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local
==> /usr/bin/sudo /usr/sbin/chown gao:admin /usr/local
==> /usr/bin/sudo /bin/mkdir /Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown gao /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 3775, done.
remote: Compressing objects: 100% (3614/3614), done.
remote: Total 3775 (delta 43), reused 522 (delta 26), pack-reused 0
Receiving objects: 100% (3775/3775), 3.22 MiB | 127.00 KiB/s, done.
Resolving deltas: 100% (43/43), done.
From https://github.com/Homebrew/homebrew
* [new branch] master -> origin/master
HEAD is now at bfbc3fc git-imerge: update 0.7.0 bottle.
==> Installation successful!
安装成功!装好了我总要找个什么试试手吧,照着网上的做法,装python:
mrgaodeMacBook-Pro:~ gao$ brew install python --with-brewed-openssl
==> Installing dependencies for python: pkg-config, readline, sqlite, gdb
==> Installing python dependency: pkg-config
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.28.yosemite.bo
######################################################################## 100.0%
==> Pouring pkg-config-0.28.yosemite.bottle.2.tar.gz
/usr/local/Cellar/pkg-config/0.28: 10 files, 612K
==> Installing python dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-6.3.8.yosemite.bot
######################################################################## 100.0%
==> Pouring readline-6.3.8.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/readline/lib
CPPFLAGS: -I/usr/local/opt/readline/include
==> Summary
/usr/local/Cellar/readline/6.3.8: 40 files, 2.1M
==> Installing python dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.8.11.1.yosemite.bo
######################################################################## 100.0%
==> Pouring sqlite-3.8.11.1.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X provides an older sqlite3.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include
==> Summary
/usr/local/Cellar/sqlite/3.8.11.1: 9 files, 2.8M
==> Installing python dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.11.yosemite.bottle.2
######################################################################## 100.0%
==> Pouring gdbm-1.11.yosemite.bottle.2.tar.gz
/usr/local/Cellar/gdbm/1.11: 17 files, 532K
==> Installing python dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.b
######################################################################## 100.0%
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
==> Summary
/usr/local/Cellar/openssl/1.0.2d_1: 464 files, 18M
==> Installing python
==> Downloading https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
######################################################################## 100.0%
==> Downloading https://bugs.python.org/file30805/issue10910-workaround.txt
######################################################################## 100.0%
==> Downloading https://bugs.python.org/file40479/xcode-stubs-2.7.patch
######################################################################## 100.0%
==> Patching
patching file Include/pyport.h
Hunk #1 succeeded at 713 (offset 14 lines).
Hunk #2 succeeded at 736 (offset 14 lines).
patching file Lib/distutils/ccompiler.py
patching file Lib/distutils/unixccompiler.py
==> ./configure --prefix=/usr/local/Cellar/python/2.7.10_2 --enable-ipv6 --datar
Last 15 lines from /Users/gao/Library/Logs/Homebrew/python/01.configure:
LDFLAGS=-isysroot
MACOSX_DEPLOYMENT_TARGET=10.10
checking build system type... x86_64-apple-darwin14.5.0
checking host system type... x86_64-apple-darwin14.5.0
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... darwin
checking EXTRAPLATDIR... $(PLATMACDIRS)
checking for --without-gcc... yes
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/private/tmp/python20151013-2366-ppbqtm/Python-2.7.10':
configure: error: C compiler cannot create executables
See `config.log' for more details
READ THIS: https://git.io/brew-troubleshooting
These open issues may also help:
recommend python -m pip https://github.com/Homebrew/homebrew/pull/44667
gobject-introspection: depend on python https://github.com/Homebrew/homebrew/pull/44673
radare2: Fix Python install path https://github.com/Homebrew/homebrew/pull/43856
(WIP) ddar: fix python shebang location, add test, fix audit https://github.com/Homebrew/homebrew/pull/44695
Google App Engine (Python) `1.9.23` => `1.9.26` https://github.com/Homebrew/homebrew/pull/44452
Errors installing packages dependent on python when pyenv installed https://github.com/Homebrew/homebrew/issues/44747
python: Create `pdb` symlinks in the local `bin` directory https://github.com/Homebrew/homebrew/issues/44128
Fix python lib finding on OS X 10.10.4 https://github.com/Homebrew/homebrew/pull/42717
Python/Python3: Fix RuntimeError: tk.h version (8.6) doesn't match libtk.a version (8.5) https://github.com/Homebrew/homebrew/pull/41728
python's sys.prefix points to a version-specific framework path https://github.com/Homebrew/homebrew/issues/42236
bokken failed to build on OSX 10.10 due to Python 2.5 dependency https://github.com/Homebrew/homebrew/issues/32016
这样以后我真的不知道要怎么搞了。。。。。
--------------------------------------------------------------
安装mysql。
mrgaodeMacBook-Pro:Frameworks gao$ brew install mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.6.27.yosemite.bottl
----------------------------------------------------------------------------
于是又上网查,各种配置的都有,最后让我找到一个。说是你要先mysql.server start, 把mysql启动起来以后才能mysql 连接。
果然
>mysql.server start;
>mysql
连接成功。
至于各位网友说的配置信息,我暂时都不是太关心,等有时间好好弄了再回来改。
mysql因为是localhost,所以随便>mysql -u xxx 都能连。
我们修改root密码:
$ mysqladmin -u root password xxxxx
尽管warning,但是我们还是改好了。
接下来登陆就需要>mysql -u root -p 然后手动输密码即可登陆。
当然了这时还是只要localhost都能随便连的。
但是只要没有-u root这句,权限还是不一样的。 select current_user(); select user(); 有区别。
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.00 sec)
mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> select user,password,host from mysql.user;
+------+-------------------------------------------+--------------------------+
| user | password | host |
+------+-------------------------------------------+--------------------------+
| root | *CB4AD0A70FCCF86E95DB2214F209ACB191DB847B | localhost |
| root | | mrgaodemacbook-pro.local |
| root | | 127.0.0.1 |
| root | | ::1 |
| | | localhost |
| | | mrgaodemacbook-pro.local |
| dba1 | *CB4AD0A70FCCF86E95DB2214F209ACB191DB847B | 192.168.3.3 |
+------+-------------------------------------------+--------------------------+
7 rows in set (0.00 sec)
最后这个dba1是我从windows的navicat远程连mac上mysql创建的用户。
mysql> grant all on *.* to dba1@'192.168.3.3' identified by "xxxxx";
Query OK, 0 rows affected (0.00 sec)
-----------------------------------
mysql> show variables like '%datadir%';
+---------------+-----------------------+
| Variable_name | Value |
+---------------+-----------------------+
| datadir | /usr/local/var/mysql/ |
+---------------+-----------------------+
1 row in set (0.00 sec)
--------------------------------------------------------------------
sublime text 2直接运行php:
参考文章:http://www.moreofless.co.uk/sublime-text-php-build-system/
Tools-->NEW BUILD SYSTEM
{
“cmd”: [“php”, “$file”],
“file_regex”: “php$”,
“selector”: “source.php”
}
保存为PHP.sublime-build即可。
,但是无奈我不会用,装app出各种篓子,真是日了狗了。
-------------------------------------------------------------
安装Xcode(自带command line tools,一直听别人说要装要装,后来发现Xcode自带),evernote,DASH 都没出什么问题。
安装Intellij IDEA, 提示说要jdk,照着它做就行了,从苹果官网下载了jdk1.6.
安装flashlight。这货真是巨坑,知乎上说好用的不得了,下了才发现用不了了。卸载了菜单上还有它的logo,我一直以为没有卸掉,试了各种clean app都没有用。最后还是我灵机一动,重启了电脑,然后那个logo就消失了。。。。。
安装麦库记事。我的windows上一直用的是它,结果装了mac版才发现不能同步过来。只好卸了。
安装百度云。这货都没有mac版,只有一个同步盘什么的,装你妹妹。。。
安装alfred,最期待的kill process workflow竟然不能用,因为这货要交钱才能用workflow。好吧,我还是留着它,确实比spotlight好用。
terminal部分:
作为一个程序员,我当然要好好利用mac终端了对不对!
装了大家都推荐的homebrew。
这里再引一部分另两篇博文:http://blog.csdn.net/delphiwcdj/article/details/19679891
http://www.tuicool.com/articles/niyQNv
------------------------------------------------------------------------------------------------
Homebrew:在Lion之后兴起的包管理工具,工作方式与MacPorts类似,下载源代码然后本地Build。不同之处在于Homebrew采取与MacPorts截然相反的态度,对系统资源是最大程度的利用,因此可以说Homebrew是直接对现有系统生态环境进行修改,所有包也是直接安装到现有的生态环境中,这样做的好处是节约了系统资源,但缺点是每一次操作都是直接对系统进行修改,严重依赖和影响现有系统。Homebrew安装之前要求安装Xcode。
(3) 如何删除Homebrew?
If you installed to
/usr/localthen you can use the script in this gist to uninstall — it will only remove Homebrew
and the stuff Homebrew installed leaving anything else in
/usr/localalone.
Provided you haven’t put anything else in Homebrew’s prefix(
brew --prefix), you can generally just
rm -rfthat directory. Thisis because Homebrew won’t touch files outside its prefix.
(4) Homebrew下载的package存放的路径在哪里?
gerryyang@mba:bin$brew --cache
/Library/Caches/Homebrew
gerryyang@mba:bin$ls /Library/Caches/Homebrew/
Formula/ wget-1.14.tar.gz
coreutils-8.22.tar.xz wget-1.15.tar.gz
openssl-1.0.1f.mavericks.bottle.tar.gz xz-5.0.5.mavericks.bottle.2.tar.gz
gerryyang@mba:bin$ls /Library/Caches/Homebrew/Formula/
coreutils.brewing openssl.brewing wget.brewing xz.brewing
gerryyang@mba:bin$
由于之前使用源码方式安装过wget,因此再用brew安装时会提示冲突的错误,因为/usr/locat/bin/wget已经存在。
实际上,Homebrew 将软件包分装到单独的目录(/usr/local/Cellar),然后 symlink 到 /usr/local 中。
------------------------------------------------------------------------------------------------------
mrgaodeMacBook-Pro:~ gao$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir /usr/local
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local
==> /usr/bin/sudo /usr/sbin/chown gao:admin /usr/local
==> /usr/bin/sudo /bin/mkdir /Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown gao /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 3775, done.
remote: Compressing objects: 100% (3614/3614), done.
remote: Total 3775 (delta 43), reused 522 (delta 26), pack-reused 0
Receiving objects: 100% (3775/3775), 3.22 MiB | 127.00 KiB/s, done.
Resolving deltas: 100% (43/43), done.
From https://github.com/Homebrew/homebrew
* [new branch] master -> origin/master
HEAD is now at bfbc3fc git-imerge: update 0.7.0 bottle.
==> Installation successful!
安装成功!装好了我总要找个什么试试手吧,照着网上的做法,装python:
mrgaodeMacBook-Pro:~ gao$ brew install python --with-brewed-openssl
==> Installing dependencies for python: pkg-config, readline, sqlite, gdb
==> Installing python dependency: pkg-config
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.28.yosemite.bo
######################################################################## 100.0%
==> Pouring pkg-config-0.28.yosemite.bottle.2.tar.gz
/usr/local/Cellar/pkg-config/0.28: 10 files, 612K
==> Installing python dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-6.3.8.yosemite.bot
######################################################################## 100.0%
==> Pouring readline-6.3.8.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/readline/lib
CPPFLAGS: -I/usr/local/opt/readline/include
==> Summary
/usr/local/Cellar/readline/6.3.8: 40 files, 2.1M
==> Installing python dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.8.11.1.yosemite.bo
######################################################################## 100.0%
==> Pouring sqlite-3.8.11.1.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X provides an older sqlite3.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include
==> Summary
/usr/local/Cellar/sqlite/3.8.11.1: 9 files, 2.8M
==> Installing python dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.11.yosemite.bottle.2
######################################################################## 100.0%
==> Pouring gdbm-1.11.yosemite.bottle.2.tar.gz
/usr/local/Cellar/gdbm/1.11: 17 files, 532K
==> Installing python dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.b
######################################################################## 100.0%
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
==> Summary
/usr/local/Cellar/openssl/1.0.2d_1: 464 files, 18M
==> Installing python
==> Downloading https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
######################################################################## 100.0%
==> Downloading https://bugs.python.org/file30805/issue10910-workaround.txt
######################################################################## 100.0%
==> Downloading https://bugs.python.org/file40479/xcode-stubs-2.7.patch
######################################################################## 100.0%
==> Patching
patching file Include/pyport.h
Hunk #1 succeeded at 713 (offset 14 lines).
Hunk #2 succeeded at 736 (offset 14 lines).
patching file Lib/distutils/ccompiler.py
patching file Lib/distutils/unixccompiler.py
==> ./configure --prefix=/usr/local/Cellar/python/2.7.10_2 --enable-ipv6 --datar
Last 15 lines from /Users/gao/Library/Logs/Homebrew/python/01.configure:
LDFLAGS=-isysroot
MACOSX_DEPLOYMENT_TARGET=10.10
checking build system type... x86_64-apple-darwin14.5.0
checking host system type... x86_64-apple-darwin14.5.0
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... darwin
checking EXTRAPLATDIR... $(PLATMACDIRS)
checking for --without-gcc... yes
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/private/tmp/python20151013-2366-ppbqtm/Python-2.7.10':
configure: error: C compiler cannot create executables
See `config.log' for more details
READ THIS: https://git.io/brew-troubleshooting
These open issues may also help:
recommend python -m pip https://github.com/Homebrew/homebrew/pull/44667
gobject-introspection: depend on python https://github.com/Homebrew/homebrew/pull/44673
radare2: Fix Python install path https://github.com/Homebrew/homebrew/pull/43856
(WIP) ddar: fix python shebang location, add test, fix audit https://github.com/Homebrew/homebrew/pull/44695
Google App Engine (Python) `1.9.23` => `1.9.26` https://github.com/Homebrew/homebrew/pull/44452
Errors installing packages dependent on python when pyenv installed https://github.com/Homebrew/homebrew/issues/44747
python: Create `pdb` symlinks in the local `bin` directory https://github.com/Homebrew/homebrew/issues/44128
Fix python lib finding on OS X 10.10.4 https://github.com/Homebrew/homebrew/pull/42717
Python/Python3: Fix RuntimeError: tk.h version (8.6) doesn't match libtk.a version (8.5) https://github.com/Homebrew/homebrew/pull/41728
python's sys.prefix points to a version-specific framework path https://github.com/Homebrew/homebrew/issues/42236
bokken failed to build on OSX 10.10 due to Python 2.5 dependency https://github.com/Homebrew/homebrew/issues/32016
这样以后我真的不知道要怎么搞了。。。。。
--------------------------------------------------------------
安装mysql。
mrgaodeMacBook-Pro:Frameworks gao$ brew install mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.6.27.yosemite.bottl
######################################################################## 100.0% ==> Pouring mysql-5.6.27.yosemite.bottle.tar.gz ==> /usr/local/Cellar/mysql/5.6.27/bin/mysql_install_db --verbose --user=gao --b ==> Caveats A "/etc/my.cnf" from another install may interfere with a Homebrew-built server starting up correctly. To connect: mysql -uroot To have launchd start mysql at login: ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents Then to load mysql now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist Or, if you don't want/need launchctl, you can just run: mysql.server start ==> Summary /usr/local/Cellar/mysql/5.6.27: 9884 files, 339M mrgaodeMacBook-Pro:Frameworks gao$ unset TMPDIR mrgaodeMacBook-Pro:Frameworks gao$ mysql_install_db FATAL ERROR: Could not find ./bin/my_print_defaults If you compiled from source, you need to run 'make install' to copy the software into the correct location ready for operation. If you are using a binary release, you must either be at the top level of the extracted archive, or pass the --basedir option pointing to that location. mrgaodeMacBook-Pro:Frameworks gao$ mysql -uroot ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
----------------------------------------------------------------------------
于是又上网查,各种配置的都有,最后让我找到一个。说是你要先mysql.server start, 把mysql启动起来以后才能mysql 连接。
果然
>mysql.server start;
>mysql
连接成功。
至于各位网友说的配置信息,我暂时都不是太关心,等有时间好好弄了再回来改。
mysql因为是localhost,所以随便>mysql -u xxx 都能连。
我们修改root密码:
$ mysqladmin -u root password xxxxx
尽管warning,但是我们还是改好了。
接下来登陆就需要>mysql -u root -p 然后手动输密码即可登陆。
当然了这时还是只要localhost都能随便连的。
但是只要没有-u root这句,权限还是不一样的。 select current_user(); select user(); 有区别。
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.00 sec)
mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> select user,password,host from mysql.user;
+------+-------------------------------------------+--------------------------+
| user | password | host |
+------+-------------------------------------------+--------------------------+
| root | *CB4AD0A70FCCF86E95DB2214F209ACB191DB847B | localhost |
| root | | mrgaodemacbook-pro.local |
| root | | 127.0.0.1 |
| root | | ::1 |
| | | localhost |
| | | mrgaodemacbook-pro.local |
| dba1 | *CB4AD0A70FCCF86E95DB2214F209ACB191DB847B | 192.168.3.3 |
+------+-------------------------------------------+--------------------------+
7 rows in set (0.00 sec)
最后这个dba1是我从windows的navicat远程连mac上mysql创建的用户。
mysql> grant all on *.* to dba1@'192.168.3.3' identified by "xxxxx";
Query OK, 0 rows affected (0.00 sec)
-----------------------------------
mysql> show variables like '%datadir%';
+---------------+-----------------------+
| Variable_name | Value |
+---------------+-----------------------+
| datadir | /usr/local/var/mysql/ |
+---------------+-----------------------+
1 row in set (0.00 sec)
--------------------------------------------------------------------
sublime text 2直接运行php:
参考文章:http://www.moreofless.co.uk/sublime-text-php-build-system/
Tools-->NEW BUILD SYSTEM
{
“cmd”: [“php”, “$file”],
“file_regex”: “php$”,
“selector”: “source.php”
}
保存为PHP.sublime-build即可。
相关文章推荐
- UVa 10020 - Minimal coverage
- 正确使用Block避免Cycle Retain和Crash
- Android复习(一) Intents and Intent Filters
- 网络软件大潮清理“国内泡沫”
- ThreadLocal http://blog.jobbole.com/20400/
- Codevs P3955 最长严格上升子序列(加强版)(nlogn求法)
- Android在BroadcastReceiver中通过接口回调更新界面
- Linux与BSD中TCP协议栈实现比较
- (多线程-单例设计模式-懒汉式)
- 医疗保险
- iOS 之 runtime --- 集百家之言
- Spring旅程(一)为什么使用Spring
- C# 知识点随手学习网站推荐
- 动态设置uitableview高度,参考
- 第三例:Activity的生命周期
- 新装 nginx 容易报的错误Primary script unknown
- ViewFlipper实现界面切换效果
- 史上最详细的Android Studio系列教程三--快捷键
- Android 叶子动态loading动效分析与实现!
- FragmentManager与getSupportFragmentManager()