ubuntu安装mysql

系统 1505 0

mysql有deb包,但是用过一次,感觉不如源码编译安装好,卸载后选择下载源码重新安装。

    # Preconfiguration setup

shell> 
    
      
        groupadd mysql
      
    
    

shell> 
    
      
        useradd -r -g mysql mysql
      
    
    

# Beginning of source-build specific instructions

shell> 
    
      
        tar zxvf mysql-
        
          
            VERSION
          
        
        .tar.gz
      
    
    

shell> 
    
      
        cd mysql-
        
          
            VERSION
          
        
      
    
    

shell> 
    
      
        cmake .
      
    
    

shell> 
    
      
        make
      
    
    

shell> 
    
      
        make install
      
    
    

# End of source-build specific instructions

# Postinstallation setup

shell> 
    
      
        cd /usr/local/mysql
      
    
    

shell> 
    
      
        chown -R mysql .
      
    
    

shell> 
    
      
        chgrp -R mysql .
      
    
    

shell> 
    
      
        scripts/mysql_install_db --user=mysql
      
    
    

shell> 
    
      
        chown -R root .
      
    
    

shell> 
    
      
        chown -R mysql data
      
    
    

shell> 
    
      
        bin/mysqld_safe --user=mysql &
      
    
  

ubuntu下用cmake时可能会报错,按照提示安装一个包后重新cmake。

 

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

一般是/etc/init.d/目录下。命令如下:

      
        1
      
      
        cp
      
       support-files/mysql.server /etc/init.d/
      
        mysql 


      
      
        2
      
      
        chmod
      
       +x /etc/init.d/
      
        mysql


      
      
        3
      
       chkconfig --add mysql
    

第一个命令是复制并重命名,很简单。

第二个命令为mysql服务器文件添加可执行权限。

第三个命令设置系统中所有服务在各运行级别中的启动和关闭状态。

 

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

 

      
        1
      
       ./bin/mysqladmin -u root password 
      
        '
      
      
        new-password
      
      
        '
      
      
        2
      
       ./bin/mysqladmin -u root -h 主机 password 
      
        '
      
      
        new-password
      
      
        '
      
    

 

Alternatively you can run:

 

      
        1
      
       ./bin/mysql_secure_installation
    

 

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

 

See the manual for more instructions.

 

You can start the MySQL daemon with:

 

      
        1
      
       cd . ; ./bin/mysqld_safe &
    

 

You can test the MySQL daemon with mysql-test-run.pl

 

      
        1
      
       cd mysql-test ; 
      
        perl
      
       mysql-test-run.pl
    

 

New default config file was created as ./my.cnf and

will be used by default by the server when you start it.
You may edit this file to change server settings

 

 

ubuntu安装mysql


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论