mysql installation, start-up and basic configuration - mac version

installation

Step one: open the URL, https: //www.mysql.com, then click on downloads jump to https://www.mysql.com/downloads/ select Community Options

 

 

Step Two: After the first step of the program will jump to https://dev.mysql.com/downloads/ URL, click MySQL Community Server enter the following page, then click the 5.6 version of the database

 

 

The third step: mac operating system version 5.6 after clicking will jump to https://dev.mysql.com/downloads/mysql/5.6.html#downloads URL, the page is as follows,

Confirm the download version and operating system, click Download

 

Step four: you can not log in or register, simply click No thanks, just start my download can be downloaded. 

 

Step Five: Double-click the downloaded dmg file, bomb box will pop up pkg, pkg then double-click the icon, enter the installation interface

 

Step Six: Continue all the way on the installation interface, and finally the installation was successful.

 

 

Environment Variables

The first step: the terminal is switched to the root directory, edit the file ./.bash_profile

$ Cd ~ 
$ vim. /.bash_profile

Step two: enter vim editing environment. I Press enter insert mode, the input

export PATH=$PATH:/usr/local/mysql/bin
export PATH=$PATH:/usr/local/mysql/support-files

The third step: Press esc to exit insert mode, enter: wq to save the configuration file.

:wq

Step four: Enter the following command in the terminal screen, the changes to take effect profile, and see the environment variable is set success

$ source ~/.bash_profile 
$ echo $PATH

 

停止MySQL服务
sudo mysql.server stop

重启MySQL服务
sudo mysql.server restart

查看MySQL服务状态
sudo mysql.server status
MySQL服务的启停和状态的查看

 

启动

第一步 :终端界面下输入

sudo mysql.server start

 第二步 :启动mysql服务,启动成功后继续输入

mysql -u root -p

 第三步 :直接回车进入数据库,看到下列欢迎页面

初始化设置

设置初始化密码,进入数据库mysql数据库之后执行下面的语句,设置当前root用户的密码为root

set password = password('root');

exit
退出sql界面

 

配置

进入到 /usr/local/mysql/support-files 目录。里面有个文件:my-default.cnf

将其复制到桌面上,改名为my.cnf,将内容替换为。

复制代码
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
port = 3306

[client]
default-character-set=utf8
复制代码

将修改后的文件my.cnf复制到 /etc 目录下。

重启mysql

$mysql>>>show variables like '%char%';
检测修改结果

 

至此数据库就可以愉快的使用啦!

 

安装

第一步:打开网址,https://www.mysql.com,点击downloads之后跳转到https://www.mysql.com/downloads/选择Community选项

 

 

第二步: 第一步结束后程序会跳转到https://dev.mysql.com/downloads/网址,点击MySQL Community Server进入下面的页面,再点击5.6版本的数据库

 

 

第三步:mac操作系统 点击5.6版本之后会跳转到https://dev.mysql.com/downloads/mysql/5.6.html#downloads 网址,页面如下,

确认好要下载的版本和操作系统,点击Download

 

第四步:可以不用登陆或者注册,直接点击No thanks,just start my download就可以下载了。 

 

第五步:双击下载好的dmg文件,会弹出pkg弹框,再双击pkg图标,进入安装界面

 

第六步:在安装界面上一路继续,最后就安装成功了。

 

 

环境变量

第一步 :在终端切换到根目录,编辑./.bash_profile文件

$ cd ~
$ vim ./.bash_profile

第二步 :进入vim 编辑环境。 按下i 进入 insert 模式 ,输入

export PATH=$PATH:/usr/local/mysql/bin
export PATH=$PATH:/usr/local/mysql/support-files

第三步 :按下esc 退出 insert 模式,输入:wq保存配置文件。

:wq

第四步 :在终端界面下输入以下命令,让配置文件的修改生效,并查看环境变量是否设置成功

$ source ~/.bash_profile 
$ echo $PATH

 

停止MySQL服务
sudo mysql.server stop

重启MySQL服务
sudo mysql.server restart

查看MySQL服务状态
sudo mysql.server status
MySQL服务的启停和状态的查看

 

启动

第一步 :终端界面下输入

sudo mysql.server start

 第二步 :启动mysql服务,启动成功后继续输入

mysql -u root -p

 第三步 :直接回车进入数据库,看到下列欢迎页面

初始化设置

设置初始化密码,进入数据库mysql数据库之后执行下面的语句,设置当前root用户的密码为root

set password = password('root');

exit
退出sql界面

 

配置

进入到 /usr/local/mysql/support-files 目录。里面有个文件:my-default.cnf

将其复制到桌面上,改名为my.cnf,将内容替换为。

复制代码
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
port = 3306

[client]
default-character-set=utf8
复制代码

将修改后的文件my.cnf复制到 /etc 目录下。

重启mysql

$mysql>>>show variables like '%char%';
检测修改结果

 

至此数据库就可以愉快的使用啦!

 

Guess you like

Origin www.cnblogs.com/l-hf/p/11533910.html