申请了一台云主机,需要手动安装所有环境,今天将mysql安装过程记下。

安装mysql
a. 下载不了gcc, 需要先运行apt-get update
b. cmake报错,每次要先删除cmakeCache.txt,再重新跑cmake
c. apt-get install ncurses找不到对应包,google后发现在Ubuntu中'ncurses-devel'是以'libncurses5-dev'命名的。
大致步骤如下
# 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
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql & [以safe模式启动mysql]
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

root@AY140420095828962476Z:/usr/local/mysql# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

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

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

./bin/mysqladmin -u root password 'new-password'  设置密码
./bin/mysqladmin -u root -h AY140420095828962476Z password 'new-password'

Alternatively you can run:
./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:
cd . ; ./bin/mysqld_safe &  启动mysql

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl  全面检测mysql

Please report any problems with the ./bin/mysqlbug script!

============================================

装完成后,发现mysql只能在本机连接,解决方法

1、改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"

Sql代码
  1. mysql -u root -pvmwaremysql>use mysql;
  2. mysql>update user set host = '%' where user = 'root';
  3. mysql>select host, user from user;

3、如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码

Sql代码
  1. GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY
  2. 'mypassword' WITH GRANT OPTION;
  3. FLUSH   PRIVILEGES;

Sql代码

  1. GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY
  2. 'mypassword' WITH GRANT OPTION;
  3. FLUSH   PRIVILEGES;

注意授权后必须FLUSH   PRIVILEGES;否则无法立即生效。

另外一种方法:
在安装mysql的机器上运行:  
  1、d:\mysql\bin\>mysql   -h   localhost   -u   root  
        //这样应该可以进入MySQL服务器  
  2、mysql>GRANT   ALL   PRIVILEGES   ON   *.*   TO   'root'@'%'   WITH   GRANT   OPTION  
        //赋予任何主机访问数据的权限  
  3、mysql>FLUSH   PRIVILEGES  
        //修改生效  
  4、mysql>EXIT  
        //退出MySQL服务器  
  这样就可以在其它任何的主机上以root身份登录啦!

ubuntu 手动安装mysql的更多相关文章

  1. ubuntu离线安装mysql

    一:ubuntu离线安装mysql 转载来源:https://blog.csdn.net/liuhuoxingkong/article/details/80696574 参考文章:https://ww ...

  2. Ubuntu 下安装 Mysql

    这里讲用Ubuntu下安装MySql ubuntu上安装mysql非常简单只需要几条命令就可以完成. 1. sudo apt-get install mysql-server   2. apt-get ...

  3. ubuntu上安装mysql 编译安装

    为什么要折腾?首先说明的是ubuntu上安装mysql等软件是非常容易简单的,其简单的程度盖过windows上的安装,一句sudo apt-get install就可以搞定.如果想用最简便的方法安装m ...

  4. Ubuntu下安装MySQL 5.6.23

    Ubuntu下安装MySQL 5.6.23 1.下载相应Linux-generic的源代码包.解压,将解压后的文件夹重命名为mysql.移动到/usr/local文件夹下: tar –xzf mysq ...

  5. Ubuntu 14 安装MySQL指南

    ubuntu 14 安装MySQL指南安装MySQLsudo apt-get install mysql-server这个应该很简单了,而且我觉得大家在安装方面也没什么太大问题,所以也就不多说了,下面 ...

  6. Ubuntu下安装mysql与mysql workbench

    Ubuntu 安装jdk:[链接] Ubuntu安装eclipse:[链接] Ubuntu下安装MySQL与mysql workbench:[链接] Ubuntu配置tomcat9:[链接] 1.su ...

  7. ubuntu下安装mysql和配置远程访问

    ubuntu下安装mysql和配置远程访问   下载安装mysql sudo apt-get install mysql-client mysql-server 安装的时候会提示要设置root密码,如 ...

  8. Ubuntu上安装MySQL

    Ubuntu上安装MySQL非常简单只需要几条命令就可以完成.`````` sudo apt-get update sudo apt-get install mysql-server 会弹出提示,让输 ...

  9. Ubuntu下安装MySQL及简单操作

    Ubuntu上安装MySQL非常简单只需要几条命令就可以完成. 1. sudo apt-get install mysql-server 2. apt-get isntall mysql-client ...

随机推荐

  1. 浅谈跨域以WebService对跨域的支持

    跨域问题来源于JavaScript的同源策略,即只有 协议+主机名+端口号 (如存在)相同,则允许相互访问.也就是说JavaScript只能访问和操作自己域下的资源,不能访问和操作其他域下的资源. 在 ...

  2. USB学习笔记连载(十二):USB描述符

    USB设备是端口,接口,配置的集合,USB协议是以各种USB描述符来表征USB设备的功能.计算机通过这些描述符来获得USB设备的功能. USB描述符包括: USB标准设备描述符,USB集线器描述符.H ...

  3. Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat 解决办法

    问题描述 安装 Python的MySQL驱动时时出现这个错误: Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat 环境 ...

  4. DataFrame在算术方法中填充值

    在对不同索引的对象进行算术运算时, 你可能希望当一个对象中某个轴标签在另一个对象中找不到时填充一个特殊值(比如0)

  5. Spring JDBC对象批量操作

    以下示例将演示如何使用spring jdbc中的对象进行批量更新.我们将在单次批次操作中更新student表中的记录. student表的结果如下 - CREATE TABLE student( id ...

  6. Python——eventlet.event

    该模块提供eventlet的事件支持,事件提供了跨 greenthread 的操作原语. 同一个事件对象既可以发出事件也可以接收(等待)事件,不同的协程共享这一个事件对象,就为不同协程之间基于事件的同 ...

  7. UNIX环境编程学习笔记(22)——进程管理之system 函数执行命令行字符串

    lienhua342014-10-15 ISO C 定义了 system 函数,用于在程序中执行一个命令字符串.其声明如下, #include <stdlib.h> int system( ...

  8. Android SDK Content loader has encountered a problem” “parseSdkContent Failed ”

    昨天做了一个Android的小程序,调试的时候连接真实的手机,而不是用模拟器.今天早上打开eclipse的时候报错:“Android SDK Content loader has encountere ...

  9. BareTail大文件日志实时查看工具

    BareTail 动态的查看日志文件,就像Linux上的tail tail -f nohup.out 功能: 实时文件查看 tail命令模式,自动滚动 支持2g以上大文件 自动滚动 彩色监控 多文件监 ...

  10. jQuery easyUI的datagrid,如何在翻页以后仍能记录被选中的行

    1.先给出问题解决后的代码 <%@ page language="java" import="java.util.*" pageEncoding=&quo ...