mysql window/linux 安装及配置

mysql各个版本html

官网下载地址mysql

http://dev.mysql.com/downloads/mysql/linux

各个版本安装请看官方教程sql

http://dev.mysql.com/doc/refman/5.7/en/installing.htmlshell

请选择本身安装的版本windows

window zip安装安全

  1. 下载window zip包解压到出来我安装在D盘中,而后在在文件中新建一个data文件夹
    修改my-default.ini 配置

    配置中反斜杠的使用,你能够在官方文档找到这个说明

     
  2. 进入bin目录执行初始化操做

     
  3. 按照官方步骤这里须要开启服务首次(Starting the Server for the First Time)
     

     
  4. 而后安装



     
  5. 安装完成后 开启


     
  6. 因为mysql对于安全增强了,刚安装的时候会有一个初始的密码,该密码会记录在你建立的data/目录里面的一个xxxx.err文件中


    拷贝密码的时候别吧空格拷进去了

     
  7. 登入mysql

    我这里已经把个人密码修改为了root了

     
  8. 修改mysql密码
    mysqladmin -u root -p password root1234 回车 输入旧的密码



    我这里把原来的旧密码root改为了root1234了

    到此完成了mysql在window zip的安装以及配置了
    这个是官方的安装文档
    http://dev.mysql.com/doc/refman/5.7/en/windows-installation.html

    若是你中途安装有问题就remove掉mysql吧服务器

从新安装吧spa

linux下mysql的安装code

来看官方文档吧

http://dev.mysql.com/doc/refman/5.7/en/linux-installation-rpm.html

初始密码和修改密码

  • A superuser account 'root'@'localhost' is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command for RHEL, Oracle Linux, CentOS, and Fedora systems:

    shell> sudo grep 'temporary password' /var/log/mysqld.log

    Use the following command for SLES systems:

    shell> sudo grep 'temporary password' /var/log/mysql/mysqld.log

    The next step is to log in with the generated, temporary password and set a custom password for the superuser account:

shell> mysql -uroot -p
 

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

这个也是官方 ,

在linux下面的mysql若是须要远程访问的话须要配置ip地址的

你想root使用password从任何主机链接到mysql服务器的话。

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

若是你想容许用户myuser从ip为192.168.100.120的主机链接到mysql服务器,并使用mypassword做为密码

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.100.120' IDENTIFIED BY 'password’ WITH GRANT OPTION;

 

若是你有什么问题话 请留言吧

相关文章
相关标签/搜索