首页 > 代码库 > Mysql编译安装
Mysql编译安装
创建mysql用户,组:
# groupadd mysql
# useradd mysql -M -s /sbin/nologin
开始进行编译安装:
# cd mysql-5.6.28
# ./configure \
--prefix=/application/mysql5.6.28 \ #指定路径
--with-unix-socket-path=/application/mysql5.6.28/tmp/mysql.sock \ #指定sock的路径
localstatedir=/application/mysql5.6.28/data \ #数据路径
--enable-assembler \ #
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pathread \
--enable-assembler \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \
# make
# make install
拷贝配置文件:
# cp /home/alex/tools/mysql-5.1.72/support-files/my-small.cnf /etc/my.cnf
创建数据目录:
# mkdir /application/mysql/data -p
修改数据目录的用户组和用户:
# chown -R mysql.mysql /application/mysql/data
初始化数据库:
# /application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
启动Mysql服务:
# /application/mysql/bin/mysqld_safe &
查看3306端口来查看服务是否启动:
# netstat -tunpl |grep 3306
给mysqlroot 用户设置密码:
# mysqladmin -uroot password ‘redhat‘
mysql简单语句:
查询mysql用户
select user,host from mysql.user;
删除用户为root主机为localhost的用户
drop user root@localhost;
删除用户为空主机为localhost的用户
drop user ""@localhost;
更新mysql.user这个库
update mysql.user set host=‘localhost‘ where user=‘root‘ and host=‘127.0.0.1‘;
alex将为你们更新后面的PHP报错解决方法,希望以上博文对各位Linux爱好者有用~~
linux运维交流群:288746884
本文出自 “11794562” 博客,请务必保留此出处http://11804562.blog.51cto.com/11794562/1899622
Mysql编译安装