Linux下快速安装mysql数据库

2023-10-16 1331阅读

如何在Linux下快速安装mysql数据库呢?Linux安装环境:centos 5.6 /redhat 5.5?\”Development Tools\”二、下载并解压mysqll-5.5源码包1、?mysql源码包官方下址:http://dev.mysql.com/downloads/mysql/5.5.html2、?进入mysql目录进行编译:cd?-DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql -DMYSQL_DATADIR:PATH=/database -DWITH_DEBUG:BOOL=on -DWITH_EXTRA_CHARSETS:STRING=all -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=on -DWITH_PARTITION_STORAGE_ENGINE:BOOL=on2、?六、设置mysql启动脚本1、从mysql源目录下复制脚本到/etc/init.d/目录下:cp ?start /restart /stop连接测试#/usr/local/mysql/bin/mysql?mysql>grant all on *.* to \’root\’@\’localhost\’ IDENTIFIED BY \’你的密码\’with grant option ;mysql>flush privileges;?方法3.进入mysql库修改user表mysql>use mysql;mysql>update user set password=password where user=\’root\’;?《Linux下快速安装mysql数据库》来自互联网同行内容,若有侵权,请联系我们删除!

如何在Linux下快速安装mysql数据库呢?茶猫有妙招!Linux安装环境:centos 5.6 /redhat 5.5? 2bit??一、安装前环境配置:1、yum install -y ? cmake ?make ?gcc ?ncurses-devel ?gcc-c++2、也可把开发包安装一起安装好:yum ?groupinstall ?\”Development Tools\”二、下载并解压mysqll-5.5源码包1、? mysql源码包官方下址:http://dev.mysql.com/downloads/mysql/5.5.html2、? 解压下载的源码包到/usr/src目录下:tar ?xzvf ?mysql-5.5.8.tar.gz ?-C ?/usr/src 三、编译并安装1、? 进入mysql目录进行编译:cd? ?/usr/src/mysql-5.5.8/cmake? -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql -DMYSQL_DATADIR:PATH=/database -DWITH_DEBUG:BOOL=on -DWITH_EXTRA_CHARSETS:STRING=all -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=on -DWITH_PARTITION_STORAGE_ENGINE:BOOL=on2、? 编译安装:make? &? make install ?四、配置mysql配置文件:1、? 进入mysql目录下创建一个etc目录然后创建一个mysql配置文件my.cnf?cd /usr/local/mysql ? ?mkdir etc?????????????? 2、服务端的配置如下:vim ?/usr/local/mysql/etc/my.cnf?? //进入到mysql服务器端配置文件[mysqld] ? //服务器端datadir=/database-5.5.8basedir=/usr/local/mysqlport=3306user=mysqlsocket=/var/run/mysqld5.5.8/mysql5.socketpid-file=/var/run/mysqld5.5.8/mysql5.pidgeneral-loggeneral-log-file=/var/log/mysqld5.5.8/mysql5-access.loglog-error=/var/log/mysqld5.5.8/mysql5-error.log?vim ?/etc/my.cnf??? //进入到mysql客户端配置文件[mysql] ?//客户端socket=/var/run/mysqld5.5.8/mysql5.socket?五、初始化数据:1、创建相关目录并授权:mkdir ?/database?mkdir ? /var/log/mysqld ? /var/run/mysqld???????????? 2、授权:首先检查mysql用于是否存在 ? 没有就创建? useradd? mysqlchown ?-R ?mysql.mysql ?/var/run/mysqld ?/var/log/mysqld /usr/local/mysql /database ? ?-R 递归???3、初始化数据:/usr/local/mysql/scripts/mysql_install_db? –basedir=/usr/local/mysql –datadir=/database ? –user=mysql ??六、设置mysql启动脚本1、从mysql源目录下复制脚本到/etc/init.d/目录下:cp ?/usr/src/mysql-5.5.8/support-files/mysql.server ?/etc/rc.d/init.d/mysql5?2、修改mysql5启动脚本vim /etc/rc.d/init.d/mysql5basedir=/usr/local/mysqldatadir=/databaseconf=/usr/local/mysql/etc/my.cnf??活动:慈云数据爆款香港服务器,CTG+CN2高速带宽、快速稳定、平均延迟10+ms 速度快,免备案,每月仅需19元!! 点击查看???????? 3、加入到chkconfigchkconfig ?–add mysql5chkconfig ?mysql5 ?on??? ?????七、启动mysql服务server mysql5 ??start /restart /stop连接测试#/usr/local/mysql/bin/mysql?八、修改mysql初始密码方法1.用root 进入mysql后mysql>set password =password(\’你的密码\’);mysql>flush privileges;?方法2.使用GRANT语句?mysql>grant all on *.* to \’root\’@\’localhost\’ IDENTIFIED BY \’你的密码\’with grant option ;mysql>flush privileges;? 方法3.进入mysql库修改user表mysql>use mysql;mysql>update user set password=password(\’你的密码\’) where user=\’root\’;?mysql>flush privileges;???????????????????????????????????????????????????????????????? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?本文来自茶猫

Linux下快速安装mysql数据库
(图片来源网络,侵删)

《Linux下快速安装mysql数据库》来自互联网同行内容,若有侵权,请联系我们删除!

VPS购买请点击我

文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

目录[+]