-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_SSL=yes
[root@localhost ~]make .
[root@localhost ~]#make
[root@localhost ~]#make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /usr/local/mysql
shell> chown -R mysql.mysql /usr/local/mysql
[root@localhost mysql]# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
//查看MYSQL是否正常启动
[root@localhost mysql]# ps -ef|grep mysql
root 12381 2182 0 17:21 pts/0 00:00:00 /bin/sh bin/mysqld_safe --user=mysql
mysql 12637 12381 0 17:21 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/dbdata --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/dbdata/localhost.localdomain.err --pid-file=/data/dbdata/localhost.localdomain.pid --socket=/usr/local/mysql/tmp/mysql.sock --port=3306
root 12706 2236 0 18:45 pts/1 00:00:00 grep mysql
shell> cp support-files/mysql.server /etc/init.d/mysql.server
[root@localhost ~]# chmod +w /usr/local/mysql
[root@localhost ~]# chown -R mysql:mysql /usr/local/mysql #改变目录拥有者与所属组
[root@localhost ~]# ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
[root@localhost ~]# cd support-files/
[root@localhost ~]# cp my-large.cnf /etc/my.cnf # 选择默认 配置文件 适合大型服务器
[root@localhost ~]# cp mysql.server /etc/init.d/mysqld # 复制启动文件
将 mysql 加入开机启动
[root@localhost ~]# chmod +x /etc/init.d/mysqld
[root@localhost ~]# vi /etc/init.d/mysqld (编辑此文件,查找并修改以下变量内容:)
basedir=/usr/local/mysql
datadir=/var/mysql/data
[root@localhost ~]# chkconfig --add mysqld
[root@localhost ~]# chkconfig --level 345 mysqld on
启动 mysql
[root@localhost ~]# service mysqld start
给mysql设置密码,mysql默认密码为空
通过登录mysql系统,
#mysql -uroot -p
Enter password: 【输入原来的密码】默认密码为空,直接按回车键
mysql>use mysql;
mysql>update user set password=passworD("test") where user='root';
mysql>flush privileges;
mysql>exit;
mysql安装好,默认没有打开远程访问,下面打开远程访问方法
通过登录mysql系统,
#mysql -uroot -p
Enter password: 输入密码成功登录后
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;