在Centos7中安装mysql 5.7.19,得到许可错误

时间:2017-10-10 02:37:41

标签: mysql

我想在/ usr / local / mysql以外的其他地方安装mysql。 运行命令'sudo bin / mysqld --defaults-file = / home / hadoop / app / mysql-5.7.19-linux-glibc2.12-x86_64 / my.cnf --initialize --user = mysql'时,获取以下错误:

const NOTHING = {};
//see if x is like a promise (has a "then" method)
const promiseLike =
  x =>
    (x!==undefined && typeof x.then === "function")
;
/**
 * 
 * takes a function fn and returns a function that takes x
 * and calls fn(x) if x does not equal NOTHING
 * if x does equal NOTHING it returns NOTHING 
 */
const wrapMaybe = 
  fn =>
  x =>
      (promiseLike(x))   
        ?x.then(wrapMaybe(fn))
        :(x === NOTHING)?NOTHING:fn(x)
;
/**
 * 
 * takes 2 functions and turns it into:
 * fn2(fn1(x)) when a value x is provided
 * if x is a promse it will turn it into:
 * x.then(x => fn2(fn1(x)))
 * if fn1(x) is a promise it will turn it into:
 * fn1(x).then(x => fn2(x))
 * if both x and fn1(x) are promises:
 * x.then(x => fn1(x)).then(x => fn2(x))
 */
const compose2 =
  fn1=>
  fn2=>
  x => {
    //if the current value is a promise
    if(promiseLike(x)){
      return x.then(x => compose2(fn1)(fn2))
    }
    const res1 = fn1(x);
    if(promiseLike(res1)){
      //result of fn1(x) is a promise
      //  invoke fn2 with the promise resolved value
      return res1.then(x => fn2(x))
    }
    //no promise, invoke fn2 with result of fn1(x)
    return fn2(res1);

  }
;
/**
 * turns an array of functions [fn1,fn2,fn3] into:
 * fn3(fn2(fn3(x)))
 * both x or any of the results of the functions can be a promise
 * If it is a promse then the next function will be called with
 * the resolve value of the promise.
 * If the promse is rejected the next function is not called
 * the handler for reject is called later down the promise chain
 * for example fn2 returns a rejected promise:
 * fn1(x)
 * .then(x => fn2(x))
 * .then(notCalled => fn3(notcalled))
 * .then(undefined,called)
 */
const compose =
  fns =>
    fns.reduce(
      (acc,fn) => compose2(acc)(fn)
      ,x=>x//id function
    )
;
/**
 * Turns an array of functions into compose(arrOfFunctions)
 * but maps the functions to wrapMaybe(function):
 * fn turns into wrapMaybe(fn)
 */
const composeWithMaybe =
    fns =>
      compose(
        fns.map(fn=>wrapMaybe(fn))
      )
;
const source = Rx.Observable.from([1,2,3,4,5]);
const mapHandlers = 
  [
    val => console.log("map:",1,"value:",val) || val + 10
    // you can return a promise in the function(s)
    //  from then on all results will be promises but next
    //  function is not called with the promise but it's resolve value
    // ,val => console.log("map:",2,"value:",val) || Promise.resolve(NOTHING)
    ,val => console.log("map:",2,"value:",val) || NOTHING
    // instead of Some or None you could return a rejected promise
    //  this basically gets you the same thing, none of the other
    //  functions are called, the result is a promise value that
    //  will invoke it's reject handler
    // ,val => console.log("map:",2,"value:",val) || Promise.reject("Rejected reason")
    ,val => console.error("map should not be executed:",3,"value:",val) || val + 10
  ]
;
const example = source
  .map(
    composeWithMaybe(
      mapHandlers
    )
  )
;
//synch example
example.subscribe(val => console.log(val));

// asynch example, you need to return a promise in one of the funcitons
// example.subscribe(
//   val => val.then(
//     val => console.log(val)
//     ,reject => console.warn(reject)
//   )
// );

的my.cnf:

`2017-10-10T02:21:29.369158Z 0 [ERROR] Aborting
`2017-10-10T02:21:27.717508Z 0 [Warning] TIMESTAMP with implicit DEFAULT 
`value is deprecated. Please use --explicit_defaults_for_timestamp server 
`option (see documentation for more details).
`2017-10-10T02:21:29.109331Z 0 [Warning] InnoDB: New log files created, LSN=45790
`2017-10-10T02:21:29.272647Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
`2017-10-10T02:21:29.347131Z 0 [Warning] No existing UUID has been found, so 
`we assume that this is the first time that this server has been started. Generating a new UUID: b97c8f3c-ad61-11e7-a737-000c299b2d06.
`2017-10-10T02:21:29.351277Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
`2017-10-10T02:21:29.357864Z 1 [Note] A temporary password is generated for root@localhost: Pl)v)1&Zhl+D
`2017-10-10T02:21:29.369007Z 1 [ERROR] 1  Can't create/write to file '/home/hadoop/app/mysql-5.7.19-linux-glibc2.12-x86_64/data/mysql/db.MYI' (Errcode: 13 - Permission denied)
`2017-10-10T02:21:29.369158Z 0 [ERROR] Aborting

`2017-10-10T02:21:29.496351Z 0 [ERROR] InnoDB: Cannot open '/home/hadoop/app/mysql-5.7.19-linux-glibc2.12-x86_64/data/ib_buffer_pool.incomplete' for writing: Permission denied`

2 个答案:

答案 0 :(得分:1)

您正在以mysql用户(--user=mysql)身份运行mysql守护程序。但是,您将为其提供hadoop用户主目录中存在的路径。 mysql用户无权访问hadoop主目录。

答案 1 :(得分:1)

mysql用户应具有read, write, execute权限

chown -R mysql.mysql /home/hadoop/app/mysql-5.7.19-linux-glibc2.12-x86_64/

如果您希望2位用户使用目录,请使用setfacl

setfacl -R -m u:mysql:rwx -m u:some_other_user:rw /home/hadoop/app/mysql-5.7.19-linux-glibc2.12-x86_64/

如果您想授予特定群组的权限,请代替:u使用:g