时间:2021-07-01 10:21:17 帮助过:3人阅读
make && make install
红色部分表示禁用Debug模式。
复制代码
# 复制配置文件
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
# 进入安装路径
cd /usr/local/mysql
# 执行配置脚本
scripts/mysql_install_db --user=mysql --datadir=/db/mysql/data
# 复制服务启动脚本
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
# 启动MySQL服务
service mysql start
# 设置开机自动启动服务
chkconfig mysql on
#添加系统变量
echo "PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:\$PATH" >> /etc/profile
echo "export PATH" >> /etc/profile
source /etc/profile
>>>>>>>>>>>>>>>完成
如果发生如下错误:
[root@rekfan mysql]# service mysql restart
MySQL server PID file could not be found![失败]
Starting MySQL...The server quit without updating PID file (/usr/local/mysql/data/rekfan.pid).[失败]
黄海的问题解决办法是:
killall命令
killall命令杀死同一进程组内的所有进程。其允许指定要终止的进程的名称,而非PID。
# killall mysqld
再次查看mysqld进程:
ps -ef|grep mysqld
没有了!世界清静了。
运行 mysql
然后进入mysql> 提示符后,输入status;
查看安装情况。
复制代码
mysql> status;
--------------
mysql Ver 14.14 Distrib 5.6.10, for Linux (x86_64) using EditLine wrapper
Connection id: 1
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ‘‘
Using delimiter: ;
Server version: 5.6.10 Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /tmp/mysql.sock
Uptime: 7 sec
Threads: 1 Questions: 5 Slow queries: 0 Opens: 67 Flush tables: 1 Open tables: 60 Queries per second avg: 0.714
--------------
复制代码
#表名全部为小写,避免出现大小写敏感
vi /etc/my.cnf 添加如下内容,解决大小写表名敏感问题。
lower_case_table_names=1
修改MySQL的root用户的密码以及打开远程连接
mysql
mysql> use mysql;
复制代码
mysql> desc user;
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root"; //为root添加远程连接的能力
mysql> update user set Password = password(‘123456‘) where User=‘root‘; //设置root用户密码
mysql> select Host,User,Password from user where User=‘root‘;
mysql> flush privileges;
mysql> exit
复制代码
附自动安装脚本如下:
vi installmysql.sh
chmod 777 installmysql.sh
./installmysql.sh
内容如下:
复制代码
yum -y install wget gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake perl bison bison-devel
groupadd mysql
useradd mysql -g mysql
mkdir -p /usr/local/mysql
mkdir -p /db/mysql/data
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /db/mysql/data
chown -R mysql:mysql /usr/local/mysql/.
chown -R mysql:mysql /db/mysql/data/.
echo "PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:\$PATH" >> /etc/profile
echo "export PATH" >> /etc/profile
source /etc/profile
cd /usr/software/
#下载mysql源码包
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz
tar -zxvf mysql-5.6.17.tar.gz
cd /usr/software/mysql-5.6.17
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/db/mysql/data -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306
make && make install
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql --datadir=/db/mysql/data
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
echo "lower_case_table_names=1" >> /etc/my.cnf
service mysql start
chkconfig mysql on
mysqladmin -u root password ‘dsideal‘
service iptables stop
chkconfig iptables off
sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#‘g /etc/sysconfig/selinux
centos 安装 mysql5.6
标签: