MySQL啟動多執行個體,MySQL啟動執行個體

來源:互聯網
上載者:User

MySQL啟動多執行個體,MySQL啟動執行個體
資料庫配置

在mysql主目錄下產生資料庫檔案集

mkdir data_3307mkdir data_3308mkdir data_3309

在mysql主目錄下設定資料庫

./scirpt/mysql_install_db --datadir=/home/fanbin/code/mysql/data_3307 --user=mysql./script/mysql_install_db --datadir=/home/fanbin/code/mysql/data_3308 --user=mysql ./script/mysql_install_db --datadir=/home/fanbin/code/mysql/data_3309 --user=mysql 
多執行個體啟動設定檔
[mysqld_multi]mysqld=/home/fanbin/code/mysql/bin/mysqldmysqladmin=/home/fanbin/code/mysql/bin/mysqladminuser=root[mysqld3307]socket=/tmp/mysql_3307.sockport=3307datadir=/home/fanbin/code/mysql/data_3307/user=mysql[mysqld3308]socket=/tmp/mysql_3308.sockport=3308datadir=/home/fanbin/code/mysql/data_3308/user=mysql[mysqld3309]socket=/tmp/mysql_3309.sockport=3309datadir=/home/fanbin/code/mysql/data_3309/user=mysql
啟動資料庫

在bin目錄下啟動多執行個體

./mysqld_multi --defaults-file=/home/fanbin/code/mysql/my_multi.cnf start 3307,3308,3309
其他
設定新密碼mysqladmin -uroot -S /tmp/mysql_3307.sock password 123456登入資料庫mysql -uroot -S /tmp/mysql_3307.sock -p確認登入的資料庫show variables like '%datadir%';查使用者select user,host from mysql.user;更改全部root使用者密碼update user set password=password('123456') where user='root';更改其中host為%update user set host = '%' where user = 'root' and host = 'hp';FLUSH PRIVILEGES;查許可權mysql> show grants for root;建立使用者grant select on *.* to fanbin@'%' identified by 'fanbin';更改新添加使用者密碼update user set password=password('123456') where user='fanbin';FLUSH PRIVILEGES;

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.