mac下常用软件安装

homebrew安装,python脚本安装,mysql安装

Posted by Qiyibaba on June 11, 2020

安装应用管理工具homebrew

homebrew是mac下的一款应用管理工具,类似于npm或gem等包管理工具,常用的工具都可以在这里找到。

使用它,你可以方便的一键安装、卸载、升级各种工具,强烈建议使用。

后面的步骤完全依赖它。

打开终端,在终端中运行如下安装命令,记得开启阿里郎的加速哦。(加速后等待15秒左右后开始执行如下命令哦)

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装超时可以尝试:

/usr/bin/ruby -e \
  "$(curl -fsSL https://raw.github.cnpmjs.org/Homebrew/install/master/install)"

最新安装可以参考 官网: http://brew.sh

安装完记得更新brew仓库

brew update

使用brew安装软件(MySQL)

qiyibaba@B-92TNLVDL-1650  ~  brew install mysql
 ......
 ==> mysql
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  mysql.server start
  
qiyibaba@B-92TNLVDL-1650  ~  cd /usr/local/Cellar/mysql/8.0.19/bin/

qiyibaba@B-92TNLVDL-1650  /usr/local/Cellar/mysql/8.0.19/bin  ./mysql.server start
Starting MySQL
. SUCCESS!

qiyibaba@B-92TNLVDL-1650  /usr/local/Cellar/mysql/8.0.19/bin  ./mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
# 设置复杂密码:root123
Press y|Y for Yes, any other key for No: n
Please set the password for root here.

New password:

Re-enter new password:
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
# 移除不用密码的那个账户
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

# 允许远程登录
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

#.zshrc文件中添加
alias mysql="/usr/local/Cellar/mysql/8.0.19/bin/mysql"

qiyibaba@B-92TNLVDL-1650  ~  mysql -uroot -proot123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.19 Homebrew

Copyright (c) 2000, 2020, 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.

Mac安装python插件

 ✘ qiyibaba@B-92TNLVDL-1650  ~  sudo -i                                                                                             
Password:
B-92TNLVDL-1650:~ root# /Library/Developer/CommandLineTools/usr/bin/python3 -m pip install demjson
Collecting demjson
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/demjson/
  Downloading https://files.pythonhosted.org/packages/96/67/6db789e2533158963d4af689f961b644ddd9200615b8ce92d6cad695c65a/demjson-2.2.4.tar.gz (131kB)
    100% |████████████████████████████████| 133kB 8.4kB/s 
Building wheels for collected packages: demjson
  Building wheel for demjson (setup.py) ... done
  Stored in directory: /var/root/Library/Caches/pip/wheels/c5/d2/ab/a54fb5ea53ac3badba098160e8452fa126a51febda80440ded
Successfully built demjson
Installing collected packages: demjson
Successfully installed demjson-2.2.4
You are using pip version 19.0.3, however version 20.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.