Cài sql server 2014 trên mac

Install SQL Server directly to your Mac — no virtual machine required!

Microsoft has made SQL Server available for macOS and Linux systems. This is made possible by running SQL Server from a Docker container. Therefore, there's no need to install a virtual machine with Windows (which was the only way to run SQL Server on a Mac prior to SQL Server 2017).

Install and Configure Docker

This is a prerequisite for installing SQL Server on your Mac. Because the Mac runs SQL Server inside a Docker container, the first thing we need to do is download and install Docker (unless it's already installed). Once installed, we'll increase its memory allocation to a more suitable level for running SQL Server.

  1. Download Docker from the download page, extract it, and drag it into your Application folder.
  2. Launch Docker, and go to Preferences > Advanced and increase its memory allocation to 4GB

If I've confused you, don't worry. I've written a tutorial with screenshots: Install Docker on a Mac and Configure for SQL Server.

OK, we're now ready to install SQL Server on your Mac.

Now the Actual SQL Server Installation

Now that we've installed Docker and increased its memory allocation, we can go ahead and install SQL Server. The Mac uses the Linux image (the SQL Server for Linux Docker image).

  1. Pull the SQL Server Image

    Open a Terminal window and run the following command:*

    This pulls the latest SQL Server for Linux Docker image to your computer.

  2. Launch the SQL Server Image

    Run the following command to launch an instance of the Docker image you just downloaded:

    Replace the container name and password with your own. Also be sure to make a strong password, or you may get an error (see below).

    Also, if you downloaded a different container image, replace microsoft/mssql-server-linux with your container image.

    Here's an explanation of the above parameters:

    -dThis is an optional parameter that launches the Docker container in daemon mode. This means that it runs in the background and doesn't need its own Terminal window open. You can omit this parameter to have the container run in its own Terminal window.--name HomerThis optional parameter provides a name for the container. This can be handy when stopping and starting the container from the Terminal.-e 'ACCEPT_EULA=Y'The Y shows that you agree with the EULA (End User Licence Agreement). This is required in order to install SQL Server.-e 'SA_PASSWORD=myPassw0rd'Required parameter that sets the sa database password.-p 1433:1433This maps the local port 1433 to port 1433 on the container. This is the default TCP port that SQL Server uses to listen for connections.microsoft/mssql-server-linuxThis tells Docker which image to use. If you downloaded a different one, use that instead.

  3. Check the Docker container (optional)

    Type the following command to check that the Docker container is running.

    If it's up and running, it should return something like this:

    CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                    NAMES
    740fcb5193c6        microsoft/mssql-server-linux   "/bin/sh -c /opt/m..."   33 seconds ago      Up 31 seconds       0.0.0.0:1433->1433/tcp   Homer
    

Check your Installation & Manage SQL Server

Now that you've installed SQL Server on your Mac, you'll probably want to check that you can access it and query it, etc. Then you'll probably want to start creating databases and doing other DB-related tasks. You'll need some sort of management tool for this.

Here are three options:

Dẫn nhập

Microsoft SQL Server là một phần mềm giúp bạn quản trị cơ sở dữ liệu tốt nhất hiện nay và được sử dụng rộng rãi trong học tập và kể cả trong công việc. Ở bài này mình sẽ hướng dẫn các bạn cài đặt SQL Server.


Yêu cầu hệ thống

Để cài đặt Microsoft SQL Server hệ thống cần những yêu cầu sau:

  • Os : Windows 7 (32 bit hoặc 64 bit) trở lên.
  • CPU :  Pentium IV trở lên.
  • Ram : Ít nhất 1GB.
  • Ổ đĩa trống: Ít nhất 6GB .
  • .NET Framework: Phiên bản 3.5 SP1 .

Lưu ý trước khi cài đặt SQL SERVER

Trước khi cài đặt Microsoft SQL Server bạn cần chú ý

  • Các bạn nên cài SQL Server trước khi cài Microsoft Visual Studio để tránh xung đột.
  • Các bạn phải cài .Net Framework 3.5 trước khi mở file cài đặt SQL Server để tránh bị lỗi.
  • Các bạn phải cài SQL Server 2014 trước khi cài Red Gate SQL(SQL Toolbelt) nhé.

Phần mềm cần thiết

Để cài đặt SQL Server ta cần chuẩn bị:

  • Net Framework 3.5: (Trang chủ):
    https://www.microsoft.com/en-us/download/details.aspx?id=25150
  • SQL Server 2014: nhấp vào để tải.
  • Red Gate SQL(SQL Toolbelt): (Các bạn có thể download hoặc không)
    https://drive.google.com/open?id=0B64LZ7smfQ7qOGVxclduSDRqQ3c

Các bước cài đặt SQL SERVER

Để cài đặt Microsoft SQL Server chúng ta cần làm theo các bước như sau:

Bước 1: Sau khi download các bạn giải nén file SqlServer2014.rar sau đó khởi chạy file setup.exe. Sau khi phần mềm chạy lên bạn chọn như trong hình.

Bước 2: Quá trình cài đặt bắt đầu diễn ra.

Cài sql server 2014 trên mac

Bước 3: Quá trình cài đặt bắt đầu phần Enter the product key nếu các bạn download bản của mình key bản quyền sẽ tự động đưa vào bạn bấm Next để tiếp tục.

Bước 4:Các bạn chọn phần I accept the license terms và nên bỏ chọn phần Turn on CEIP nhấn Next để tiếp tục.

Bước 5:Phần Microsoft Update bạn nên bỏ chọn Use Microsoft Update to check for updates để quá trình cài đặt được diễn ra nhanh chóng hơn nhấn Next để tiếp tục.

Bước 6:Quá trình kiểm tra bắt đầu nếu tất cả Passed riêng phần Windows Firewall nếu có báo Warning thì bạn đừng bận tâm cứ bấm Next để tiếp tục.

Bước 7: Các bạn chọn SQL Server Feature Installation sau đó bấm Next để tiếp tục.

Bước 8: Các bạn chọn Select All để cài đặt đầy đủ nhất sau đó bấm Next để tiếp tục.

Bước 9: Bạn chọn Default instance. Một số trường hợp cài SQL Server từ lần thứ hai phải thiết đặt lại field Named instance. Nhấn Next để tiếp tục.

Bước 10:Bạn để nguyên các thiết đặt mặc định(Xem hình để tham khảo). Sau đó bấm Next để tiếp tục.

Bước 11: Trong tab Server Configuration bạn chọn Mixed Mode sau đó bạn đặt password cho 2 ô trống phía dưới(Nên khuyên đặt 123456 cho dễ nhớ) sau đó bạn nhấn Add Current User để nó add user máy bạn vào. Sau đó bấm Next để tiếp tục.

Bước 12:Trong tab Server Configuration bạn chọn Multidimensional and Data Mining Mode sau đó nhấn Add Current User để nó add user máy bạn vào. Sau đó bấm Next để tiếp tục.

Bước 13: Bạn chọn Install and configure Install only sau đó bấm Next để tiếp tục.

Bước 14: Bạn chọn Add Current User để add user của bạn vào. Bấm Next để tiếp tục.

Bước 15: Bạn để nguyên mặc định bấm Next để tiếp tục.

Bước 16:Bạn nhấn Install để quá trình cài đặt được diễn ra.

Bước 17:Bạn đợi quá trình cài đặt diễn ra thông thường từ 15phút – 30 phút tùy cấu hình máy bạn.

Bước 18:Quá trình cài đặt thành công bạn nhấn Close để kết thúc.

Bước 19: Bạn khởi động Microsoft SQL Server 2014 Management Studio lên để tiếp tục.

  • Thiết lập tài khoản theo SQL Server Authentication(Đăng nhập theo tài khoản database).
    • Phần Server type: bạn chọn Database Engine.
    • Phần Server name: bạn chọn tên máy của bạn.
    • Phần Authentication: bạn chọn SQL Server Authentication.
    • Phần Login: bạn điền sa là mặc định khi bạn cài đặt.
    • Phần Password: bạn điền password lúc bạn cài đặt mặc định là 123456.

  • Thiết lập tài khoản theo Windows Authentication(Đăng nhập theo tài khoản của máy).
    • Phần Server type: bạn chọn Database Engine.
    • Phần Server name: bạn chọn tên máy của bạn.
    • Phần Authentication: bạn chọn Windows Authentication.

Sau khi thiết lập bạn nhấn Connect để kết nối. Mình khuyên dùng tài khoản theo SQL Server Authentication thì sẽ bảo mật tốt hơn.

Bước 20: Sau khi kết nối thành công ta sẽ được giao diện như hình.


Kết luận

Qua bài hướng dẫn này chúng ta đã nắm được cách cài đặt Microsoft SQL Server 2014. Một công cụ quản lý cơ sở dữ liệu rất mạnh mẽ và dễ dàng sử dụng.

Ở bài sau mình sẽ hướng dẫn các bạn cài RedGate SQL(SQL Toolbelt) một phần mềm hỗ trợ cho SQL Server rất tốt.

Cảm ơn các bạn đã theo dõi bài viết. Hãy để lại bình luận hoặc góp ý của mình để phát triển bài viết tốt hơn. Đừng quên “Luyện tập – Thử thách – Không ngại khó”.


Thảo luận

Nếu bạn có bất kỳ khó khăn hay thắc mắc gì về khóa học, đừng ngần ngại đặt câu hỏi trong phần bên dưới hoặc trong mục HỎI & ĐÁP trên thư viện Howkteam.com để nhận được sự hỗ trợ từ cộng đồng.