CentOS下安装Mysql 伍.伍全经过

— Configuring incomplete, errors occurred!

  1. bison
    —-shell:~$ sudo apt-get install bison
    —-可选。未有这几个工具,在make的时候报出警告。
    —-警告记录:

始发工具:gcc,cmake,make 

mkdir  /usr/local/ mysql

shell:~$ sudo ln -s /usr/local/mysql/bin/mysqladmin /usr/bin

=>mysql数据库汉语乱码化解 :

  1. 乱码剖析
    —-从终端shell进入mysql
    shell:~$ mysql
    …………
    …………
    mysql> show variables like ‘%character%’
    —-获得以下数据库编码新闻表:
    +———————————–
    +——————————————-+
    | Variable_name | Value |
    +————————————+——————————————-+
    | character_set_client | utf8 |
    | character_set_connection | utf8 |
    | character_set_database | latin1 |
    | character_set_filesystem | binary |
    | character_set_results | utf8 |
    | character_set_server | latin1 |
    | character_set_system | utf8 |
    | character_sets_dir | /usr/local/mysql/share/charsets/ |
    +————————————
    +——————————————-+
    能够看到character_set_database ,character_set_server
    的编码依然暗中认可的latin一。
    不知晓干什么,在此之前DEFAULT_CHA奥迪Q3SET设置成为utf八的,好像没起功能。查看官方文书档案
    发现,character_set_database不辅助配置文件(/etc/my.cnf)变量设置,
    但是character_set_server 协助配置文件变量设置。

  2. 解决办法
    —-展开配置文件
    shell:~$ sudo gedit /etc/my.cnf
    然后在[mysqld]配备选项下增加
    character-set-server = utf8
    —-然后跻身mysql
    执行:
    mysql> show variables like ‘%character%’
    结果:character_set_database
    ,character_set_server两项都变成utf八了
    —-测试:
    往数据库表中插入中文字段,中文就像常展现了。

注:1.用五.一本子的时候如下方法是足以消除汉语编码难点的
—-在配备文件[mysqld]和[client]节下分别拉长: default-character-set
= utf八
贰.不知到是否手动编写翻译的案由,在5.5.第88中学配置文件中用上述办法会招致数据库服务不可能运维。

mysql>use mysql ; 
mysql>update user set password=PASSWORD(“bjsyx825”) where
user=’root’; 
mysql>FLUSH PRIVILEGES;

# 安装所需凭仗包

你也许感兴趣的篇章:

  • Linux下安装mysql的艺术(yum和源码编写翻译三种办法)
  • 阿里云云服务器Linux系统更新yum源Shell脚本
  • centos下yum搭建筑和安装装linux+apache+mysql+php遭受的法子
  • 在Linux中选取yum安装JDK的达成步骤
  • centos下yum搭建筑和安装装linux+apache+mysql+php景况教程
  • linux下查看yum/rpm/dpkg某软件是不是已设置的不二秘籍
  • Linux 中 RPM包 安装 查询
    卸载命令小结及yum命令详解
  • Linux+php+apache+oracle处境搭建之CentOS下源码编写翻译安装PHP
  • linux下源码安装mysql5.陆.20学科
  • Linux CentOS
    柒源码编译安装PostgreSQL玖.五
  • linux常用命令小结之yum、源码安装

追加用户组和用户 

# 创造安装目录

[ERROR] Aborting

—-那样会促成pid文件(datadir/username.pid)无法立异
—-在配置文件[mysqld]和[client]节下独家去掉: default-character-set
= utf捌 后,数据库服务就开动通常了

on RedHat and derivates it is ncurses-devel. 

mkdir  /usr/local/ mysql/data

系统:Ubuntu 10.10 mysql源码文件:mysql-伍.五.八.tar.gz
设置所需工具:cmake, GNU make, gcc, Perl, libncurses5-dev, bison(可选),
chkconfig
注:
一.官方2010-1壹-1八的源码有几处bug,在编写翻译以前参照官方的求证,进行了手动修改。

cmake/readline.cmake:126 (FIND_CURSES) 

tmpdir = /tmp

shell:~$ service mysqld stop

service命令:

  1. 用于管理Linux系统中服务的授命
  2. 效率是去/etc/init.d目录下寻觅对应的服务,举行开启和关闭等操作
  3. 上述操作后,mysqld服务文件对应mysql.server文件

—-增多劳动到自运维项
shell:~$ sudo chkconfig –level 3 mysqld on

—-设置软连接使mysql, mysqldump,
mysqladmin那八个指令能在shell中一向运营
shell:~$ sudo ln -s /usr/local/mysql/bin/mysql /usr/bin
shell:~$ sudo ln -s /usr/local/mysql/bin/mysqldump /usr/bin

下载工具:bison 

 

一声令下后边加个点不懂什么意思。在那边丰盛命令施行不断

源代码配置选项表明:
//mysql安装的主目录,5.5.八版本默认为/usr/local/mysql,所以能够不增加
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql

//mysql数据保存的门路,自定义
-DMYSQL_DATADIR=/home/system_username/mysql/mysqldata

//mysql配置文件地方——The default my.cnf option file directory
-DSYSCONFDIR=/etc

//Compile storage engine xxx statically into server
/*Storage engines are built as plugins. You can build a plugin as a
static module (compiled into the server)
*or a dynamic module (built as a dynamic library that must be installed
into the server using the INSTALL
*PLUGIN statement or the –plugin-load option before it can be used).
Some plugins might not support static
*or dynamic building.
*/
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_FEDERATED_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1

//Unix socket file
/*
*The Unix socket file path on which the server listens for socket
connections. This must be an absolute path
*name. The default is /tmp/mysql.sock
*/
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock

//数据库服务器TCP/IP连接的监听端口,默以为3306
-DMYSQL_TCP_PORT=3306

//Whether to enable LOCAL capability in the client library for LOAD DATA
INFILE
//默以为关闭,这里拉开
-DENABLED_LOCAL_INFILE=1

//数据库编码设置
-DEXTRA_CHARSETS=all
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8-general_ci
3.编写翻译和设置
—-shell定位到源代码文件夹目录
—-实践:(编写翻译用了大约二十一分钟)
shell:~$ make
shell:~$ make install

四.连任配置
—-进入mysql安装目录下的本子目录
shell:~$ cd /usr/local/mysql/scripts
—-利用mysql_install_db脚本生成新的MySQL 授权表
./mysql_install_db –basedir=/usr/local/mysql
–datadir=/home/system_username/Programming/mysql/mysqldata
–user=mysql
—-进入mysql安装目录下的支撑文件目录
shell:~$ cd /usr/local/mysql/support-files
—-复制mysql配置文件
shell:~$ sudo cp my-medium.cnf /etc/my.cnf

—-复制伏务文件并修改
shell:~$ sudo cp mysql.server mysqld
—-修改mysqld
basedir=/usr/local/mysql
datadir=/home/mysql
mv mysqld /etc/init.d/mysqld
—-运转服务
shell:~$ service mysqld start
—-关闭服务

shell> sudo groupadd mysql 

chown -R mysql:mysql /usr/local/mysql/data

  1. cmake
    —-未有和谐编写翻译安装cmake
    —-shell:~$ sudo apt-get install cmake
    —-版本:2.8.2
  2. GNU make
    —-Ubuntu自带
    —-版本:3.81
    3.GCC
    —-Ubuntu自带
    —-版本:肆.4.伍(官方文书档案:必须3.二以上)
    4.Perl
    —-Ubuntu自带
    —-版本:5.10.1
    5.libncurses5-dev (ncurses-devel)
    —-若差了这么些包,在cmake的时候会报错。
    —-Debian/Ubuntu上的包名是libncurses伍-dev,RedHat和别的版本对应的是ncurses-devel
    —-shell:~$ sudo apt-get install libncurses5-dev
    —-报错新闻
    ——————www.linuxidc.com—————
    — MySQL 5.5.8
    — Could NOT find Curses (missing: CURSES_LIBRARY
    CURSES_INCLUDE_PATH)
    CMake Error at cmake/readline.cmake:82 (MESSAGE):
    Curses library not found. Please install appropriate package,

Connect from remote server 1. Open mysql client with terminal
    mysql  [-h 127.0.0.1|localhost ] -u root -pjmbkeyes

# 1)查看是不是有经过mysql

remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu , package name is
libncurses5-dev ,
on RedHat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:126 (FIND_CURSES)
cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:256 (MYSQL_CHECK_READLINE)

/usr/local/mysql/bin/mysql -u root -p
#for muliti-servers, we may need to add more parameters([P |–port=]
3306 [S|–socket=] /tmp/mysqld.sock)

 

—-cmake执行:

shell:~$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_DATADIR=/home/system_username/Programming/mysql/mysqldata
-DSYSCONFDIR=/etc
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_FEDERATED_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock
-DMYSQL_TCP_PORT=3306
-DENABLED_LOCAL_INFILE=1
-DEXTRA_CHARSETS=all
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8-general_ci
-DMYSQL_USER=mysql
注:没有换行。官方文书档案上,cmake

Call Stack (most recent call first): 

-DENABLED_LOCAL_INFILE=1 \

官方认证链接:
二.官方5.伍本子参谋手册:
汗了刹那间,33玖二页的参谋手册!
=>工具安装:

接下来输入 

# 三)读取mysql版本消息

—-错误日志如下:( datadir/username.err为不当日志文件)

mysqld_safe mysqld from pid file
/home/cyberwym/Programming/mysql/mysqldata/cyberwym.pid ended
………..
………..
[ERROR] /usr/local/mysql/bin/mysqld: unknown variable
‘default-character-set=utf8’

遇见警告: 

# 至此,MySQL安装到位
 

Warning: Bison executables not found in PATH

7.chkconfig
—-前边配置mysql服务自运行的时候须求。
—-shell:~$ sudo apt-get install chkconfig
=>mysql安装:
1.解压源代码文件
—-shell定位到源代码文件所在目录
—-解压
shell:~$ tar zxvf mysql-5.5.8.tar.gz
2.cmake操作
—-shell定位到解压出的源代码文件夹目录(文件夹:mysql-伍.伍.八)

shell> scripts/mysql_install_db –user=mysql
–datadir=/usr/local/mysql/data
#Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host
doesn’t exist

useradd -g mysql  -s /usr/sbin/nologin  mysql

shell> sudo make install 

/usr/local/mysql/scripts/mysql_install_db –user=mysql
–basedir=/usr/local/mysql –datadir=/usr/local/mysql/data &

编译甘休 

# [mysqld] 添加:

shell> sudo useradd -r -g mysql mysql 

log-error =/usr/local/mysql/data/error.log

shell> sudo cmake . 

# 创造用户和组

设置碰到错误: 

一、安装cmake

chmod 755 /etc/init.d/mysqld 

 

remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu , package name is
libncurses5-dev , 

   www.2cto.com  

CMake Error at cmake/readline.cmake:82 (MESSAGE): 

cd cmake-2.8.5

shell> sudo cmake  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
(more options:
常用的选项有下边那几个:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
#安装目录
-DMYSQL_DATADIR=/usr/local/mysql/data \
#数据仓库储存放目录
-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \
#Unix socket 文件路径
-DWITH_MYISAM_STORAGE_ENGINE=1 \
#设置 myisam 存款和储蓄引擎
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
#设置 innodb 存储引擎
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
#设置 archive 存储引擎
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
#安装 blackhole 存款和储蓄引擎
-DWITH_PARTITION_STORAGE_ENGINE=1 \
#安装数据库分区
-DENABLED_LOCAL_INFILE=1 \
#允许从地面导入数据
-DWITH_READLINE=1 \
#火速键作用
-DWITH_SSL=yes \
#支持 SSL
-DDEFAULT_CHARSET=utf8 \
#使用 utf8 字符
-DDEFAULT_COLLATION=utf8_general_ci \
#校验字符
-DEXTRA_CHARSETS=all \
#安装具备扩张字符集
-DMYSQL_TCP_PORT=3306 \
#MySQL 监听端口
)

 

– MySQL 5.5.11 

二、 安装配置mysql

、安装所须要系统库相关库文件 

groupadd mysql

shell> sudo cmake . 

   www.2cto.com  

下一场输入 

make

– Could NOT find Curses (missing: CURSES_LIBRARY
CURSES_INCLUDE_PATH) 

libpng12-dev autoconf libpcre3-dev make bzip2 \

shell> cd /usr/local/mysql 

 

操作系统:ubuntu 1一.0肆 

# 配置开机自运营

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

make install

cp support-files/my-medium.cnf /etc/my.cnf 

chmod +x /usr/local/mysql

Warning: Bison executable not found in PATHWarning: no usable bison
found, /usr/src/mysql-5.5.11/sql/sql_yacc.yy will not be rebuilt. 

cp support-files/my-medium.cnf  /etc/my.cnf

Create new login for mysql server with permissions.
mysql>create user user1@’%’ identified by ‘user1’
mysql>grant all on *.* to user1@’%’ identified by ‘user1’;

# 测试MySQL是还是不是运营

2、创设mysql安装目录 
  # mkdir -p /usr/local/mysql/ 
4、创设用户和用户组与赋予数据存放目录权限 
  # groupadd mysql 
  # useradd -g mysql mysql 
  # chown mysql.mysql -R /usr/local/mysql/ 
伍、安装cmake(mysql5.伍自此是因此cmake来编写翻译的) 
  # wget  
  # tar zxvf cmake-2.8.4.tar.gz 
  # cd cmake-2.8.4 
  #./configure 
  # make && make install 

# 下载源文件

发表评论

电子邮件地址不会被公开。 必填项已用*标注