Centos 6.x 源码安装 Mysql 5.6.17

这里直接列出全部过程,按照过程操作即可

 

复制代码
groupadd mysql

useradd -s /bin/false -g mysql mysql

cd /usr/local/src/
wget https://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.15.tar.gz

tar zxvf mysql-5.6.15.tar.gz 

cd mysql-5.6.15

cmake  \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DWITH_EXTRA_CHARSETS=all  \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DENABLED_LOCAL_INFILE=1  \
-DWITH_INNOBASE_STORAGE_ENGINE=1  \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DSYSCONFDIR=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DMYSQL_TCP_PORT=3306 \
-DENABLE_DTRACE=0

make && make install

cd /usr/local/mysql/

 ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

ln -s my.cnf /etc/my.cnf

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

chmod 755 /etc/rc.d/init.d/mysqld 

vim /etc/rc.d/init.d/mysqld 

46 行basedir=/usr/local/mysql
47 行datadir=/usr/local/mysql/data

service mysqld start

chkconfig mysqld on

vim /etc/profile
#添加这一行
export PATH=$PATH:/usr/local/mysql/bin

source /etc/profile

mysql_secure_installation
#按照如下操作
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): 此处只需按下回车键
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y (要为root管理员设置数据库的密码)
New password: 输入要为root管理员设置的数据库密码
Re-enter new password: 再输入一次密码
Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y (删除匿名账户)
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y (禁止root管理员从远程登录)
 ... Success!
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y (删除test数据库并取消对其的访问权限)
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y (刷新授权表,让初始化后的设定立即生效)
 ... Success!
All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
 
复制代码

 

posted @   Old·Artist  阅读(208)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示