欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Ubuntu下MySQL解压安装_MySQL

程序员文章站 2022-06-11 21:30:42
...
Ubuntu

1.Ubuntu下解压到/usr/local/mysql
groupadd mysql
useradd -g mysql mysql
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
chown -R root .
chown -R mysql data
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf

2.修改my.cnf
nano /etc/my.cnf
添加
basedir=/usr/local/mysql
datadir=/home/mysql

3.初始化数据库
scripts/mysql_install_db --user=mysql

4.启动
bin/mysqld_safe --user=mysql &
修改密码
mysql>use mysql
mysql>UPDATE user SET password=PASSWORD('root') WHERE user='root';
mysql>FLUSH PRIVILEGES;
mysql>exit

5.设置自动启动
apt-get install chkconfig
chkconfig --add mysqld
chkconfig mysqld on

6.将mysql加入到path
nano /etc/profile
umask前加进这句
export PATH=$PATH:/usr/local/mysql/bin

7.重启系统
reboot