linux install mysql

来源:互联网 发布:smt贴片机编程 编辑:程序博客网 时间:2024/06/04 18:01

    • 源码编译安装mysql
    • mysql配置文件
    • mysql权限管理

源码编译安装mysql

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.23.tar.gz tar zxvf mysql-5.6.23.tar.gz cd mysql-5.6.23#cmake 生成makefilecmake \-DCMAKE_INSTALL_PREFIX=${LOCAL_PATH}/usr/local/mysql \-DMYSQL_DATADIR=${LOCAL_PATH}/usr/local/mysql/data \-DSYSCONFDIR=${LOCAL_PATH}/etc \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DMYSQL_UNIX_ADDR=${LOCAL_PATH}/var/lib/mysql/mysql.sock \-DMYSQL_TCP_PORT=3306 \-DENABLED_LOCAL_INFILE=1 \-DWITH_PARTITION_STORAGE_ENGINE=1 \-DEXTRA_CHARSETS=all \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci .# cmake相关参数参考:http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html#cmake-general-optionsmake -j16make install #进入安装路径,执行初始化配置脚本,创建系统自带的数据库和表scripts/mysql_install_db --basedir=$LOCAL_PATH/usr/local/mysql --datadir=$LOCAL_PATH/usr/local/mysql/data --user=xxxxxxoooo#执行后返回如下结果# PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:  $LOCAL_PATH/usr/local/mysql/bin/mysqladmin -u root password 'new-password'  $LOCAL_PATH/usr/local/mysql/bin/mysqladmin -u root -h g01 password 'new-password'#Alternatively you can run:  $LOCAL_PATH/usr/local/mysql/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 . ; $LOCAL_PATH/usr/local/mysql/bin/mysqld_safe &#You can test the MySQL daemon with mysql-test-run.pl  cd mysql-test ; perl mysql-test-run.plPlease report any problems at http://bugs.mysql.com/The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.comNew default config file was created as $LOCAL_PATH/usr/local/mysql/my.cnf andwill be used by default by the server when you start it.You may edit this file to change server settingsWARNING: Default config file /etc/my.cnf exists on the systemThis file will be read by default by the MySQL serverIf you do not want to use this, either remove it, or use the--defaults-file argument to mysqld_safe when starting the server#运行mysql mkdir -p $LOCAL_PATH/var/lib/mysqlcd . ; $LOCAL_PATH/usr/local/mysql/bin/mysqld_safe --defaults-file=$LOCAL_PATH/usr/local/mysql/my.cnf --user=xxxxxooooo &#修改mysql 密码 $LOCAL_PATH/usr/local/mysql/bin/mysqladmin -u root password

mysql配置文件

# For advice on how to change settings please see  # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html  [mysqld]  # Remove leading # and set to the amount of RAM for the most important data  # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.  # innodb_buffer_pool_size = 128M  # Remove leading # to turn on a very important data integrity option: logging  # changes to the binary log between backups.  # log_bin  # These are commonly set, remove the # and set as required.  # basedir = .....  # datadir = /data/mysql/data  # port = .....  # server_id = .....  # socket = .....  # Remove leading # to set options mainly useful for reporting servers.  # The server defaults are faster for transactions and fast SELECTs.  # Adjust sizes as needed, experiment to find the optimal values.  # join_buffer_size = 128M  # sort_buffer_size = 2M  # read_rnd_buffer_size = 2M   max_connection = 10000  sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES   #binary log   log-bin = mysql-bin  binlog_format = mixed  expire_logs_day = 30  #slow query log   slow_query_log = 1  slow_query_log_file = /var/log/mysql/slow.log  long_query_time = 3  log-queries-not-using-indexes  log-slow-admin-statements  

mysql权限管理

user mysqlSELECT User, Password, Host FROM user; -- 查看现有用户,密码及允许连接的主机GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.100' IDENTIFIED BY '' WITH GRANT OPTION;flush privileges;#修改root 密码 update user set password=PASSWORD('123456') where user='root';flush privileges;

创建可远程访问的用户

grant all privileges on *.* to 'dong'@'%' identified by '123456' with grant option;flush privileges
0 0
原创粉丝点击